Skip to content

Commit

Permalink
Merge pull request #11 from moosetechnology/feature/refactoring-metrics
Browse files Browse the repository at this point in the history
Feature/refactoring metrics
  • Loading branch information
alkalinan authored Jul 26, 2024
2 parents 2acb895 + 3ad3a89 commit bf401db
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
9 changes: 5 additions & 4 deletions src/GitLabHealth-Model-Analysis/GitMetricExporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,10 @@ GitMetricExporter >> maxCommitWindow: anInteger [
]

{ #category : #'as yet unclassified' }
GitMetricExporter >> onlyImportProjectsOfGroup: groupId [
|group|

GitMetricExporter >> onlyImportProjectsOfGroup: groupId [

| group |
1 halt.
group := GLHModelImporter current importGroup: groupId.
projectCache := group toScope: GLHProject.
projectCache := (group toScope: GLHProject)
]
41 changes: 20 additions & 21 deletions src/GitLabHealth-Model-Importer/GLHModelImporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ GLHModelImporter >> addGroupResultToModel: groupResult [
|group|
group := self glhModel add: groupResult unless: self blockOnIdEquality.
self glhModel
addAll: groupResult projects
addAll: group projects
unless: self blockOnIdEquality.
^ group
]
Expand Down Expand Up @@ -88,23 +88,24 @@ GLHModelImporter >> blockOnNameEquality [

{ #category : #'private - api' }
GLHModelImporter >> completeImportProject: aGLHProject [

|importedProject|
('Complete import of project: ' , aGLHProject id printString)
recordInfo.
importedProject := self glhModel add: aGLHProject unless: (self blockOnIdEquality ).

self importPipelinesOfProject: aGLHProject.
self importPipelinesOfProject: importedProject.

"aGLHProject creator: (self importUser: aGLHProject creator_id)."

(self importUser: aGLHProject creator_id) addCreatedProject:
aGLHProject.
(self importUser: importedProject creator_id) addCreatedProject:
importedProject.


aGLHProject repository: GLHRepository new.
self glhModel add: aGLHProject unless: (self blockEqualityOn: #id).
self glhModel add: aGLHProject repository.
self importRepository: aGLHProject repository.
importedProject repository: GLHRepository new.
self glhModel add: importedProject repository.
self importRepository: importedProject repository.

^ aGLHProject
^ importedProject
]

{ #category : #'as yet unclassified' }
Expand Down Expand Up @@ -574,12 +575,13 @@ GLHModelImporter >> importGroup: aGroupID [

result := self glhApi group: aGroupID.
groupResult := self parseGroupResult: result.
groupResult := self addGroupResultToModel: groupResult.

groupResult projects do: [ :project |
self completeImportProject: project ].
groupResult := self addGroupResultToModel: groupResult.

(self subGroupsOf: aGroupID) do: [ :subGroup |
self glhModel add: subGroup unless: self blockOnIdEquality.

groupResult subGroups
add: (self importGroup: subGroup id)
unless: self blockOnIdEquality ].
Expand Down Expand Up @@ -653,8 +655,8 @@ GLHModelImporter >> importParentCommitsOfCommit: aGLHCommit since: aDate [
GLHModelImporter >> importPipelinesOfProject: aGLHProject [

(self pipelinesOf: aGLHProject id) do: [ :pipeline |
self glhModel add: pipeline.
aGLHProject addPipeline: pipeline ]
self glhModel add: pipeline unless: self blockOnIdEquality .
aGLHProject pipelines add: pipeline unless: self blockOnIdEquality]
]

{ #category : #imports }
Expand Down Expand Up @@ -737,14 +739,11 @@ GLHModelImporter >> importRepository: aGLHRepository [

('import the branches of project ') recordInfo.

aGLHRepository branches
branches := aGLHRepository branches
addAll: branches
unless: self blockOnNameEquality.
self glhModel addAll: branches unless: self blockOnNameEquality.
branches := self glhModel addAll: branches unless: self blockOnNameEquality.

"branches do: [ :branch |
aGLHRepository addBranch: branch.
self glhModel add: branch ]."

self withFiles ifTrue: [
branches do: [ :branch | self importFilesOfBranch: branch ] ] ]
Expand Down Expand Up @@ -1093,10 +1092,10 @@ GLHModelImporter >> subGroupsOf: aGroupID [

parsedResult := { true }.
[ parsedResult size > 0 ] whileTrue: [
page := page + 1.
result := self glhApi subgroupsOfGroup: aGroupID page: page.
parsedResult := self parseSubGroupResult: result.
results addAll: parsedResult ].
results addAll: parsedResult.
page := page + 1. ].

^ results
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,16 @@ GLPHModelImporter >> commitsOfProject: aGLHProject forRefName: refName until: to

{ #category : #'private - api' }
GLPHModelImporter >> completeImportProject: aGLHProject [

super completeImportProject: aGLHProject.
|completedProject|
completedProject := super completeImportProject: aGLHProject.

"for this initial import, with only look at some but not all MR"
withInitialMergeRequest ifTrue: [ self
importMergeRequests: aGLHProject
importMergeRequests: completedProject
since: DateAndTime today
until: DateAndTime now. ].

^ aGLHProject
^ completedProject
]

{ #category : #'private - configure reader' }
Expand Down

0 comments on commit bf401db

Please sign in to comment.