• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moosetechnology / GitProjectHealth / 10682053149

03 Sep 2024 11:29AM UTC coverage: 18.493%. First build
10682053149

Pull #47

github

web-flow
Merge bae5d1107 into 049515451
Pull Request #47: refactor: remove GitMetric class and subclasses

0 of 176 new or added lines in 10 files covered. (0.0%)

1590 of 8598 relevant lines covered (18.49%)

0.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/GitLabHealth-Model-Analysis/UserMetric.class.st
1
Class {
2
        #name : #UserMetric,
3
        #superclass : #Metric,
4
        #instVars : [
5
                'user',
6
                'userCommits',
7
                'userMergeRequests',
8
                'emailDomain'
9
        ],
10
        #category : #'GitLabHealth-Model-Analysis'
11
}
12

13
{ #category : #utils }
14
UserMetric >> cacheSymbolFor: anEntityType since: since until: until [
×
15

×
16
        ^ (anEntityType printString , ' since ' , since printString , ' to '
×
17
           , until printString) asSymbol
×
18
]
×
19

20
{ #category : #calculating }
21
UserMetric >> calculate [
22

23
        ^ self subclassResponsibility
24
]
25

26
{ #category : #accessing }
27
UserMetric >> description [
28

29
        ^ self subclassResponsibility
30
]
31

32
{ #category : #accessing }
NEW
33
UserMetric >> emailDomain: anObject [
×
NEW
34

×
NEW
35
        emailDomain := anObject
×
NEW
36
]
×
37

38
{ #category : #churn }
NEW
39
UserMetric >> foundSuccessorOf: commits andCompleteImportForMax: commitLimit [
×
NEW
40

×
NEW
41
        | analyzingCommits i size |
×
NEW
42
        analyzingCommits := Set new.
×
NEW
43
        glhImporter withCommitDiffs: true.
×
NEW
44

×
NEW
45
        commits do: [ :c |
×
NEW
46
                GitAnalyzer new
×
NEW
47
                        visitChildCommits: c childCommits
×
NEW
48
                        toStoreThemIn: analyzingCommits
×
NEW
49
                        upto: commitLimit ].
×
NEW
50

×
NEW
51
        i := 0.
×
NEW
52
        size := analyzingCommits size.
×
NEW
53
        analyzingCommits do: [ :c |
×
NEW
54

×
NEW
55
                glhImporter completeImportedCommit: c ].
×
NEW
56

×
NEW
57
        ^ analyzingCommits
×
NEW
58
]
×
59

60
{ #category : #initialization }
61
UserMetric >> initialize [
×
62
        over := Date
×
63
]
×
64

65
{ #category : #loading }
66
UserMetric >> load [
67

68
        ^ self subclassResponsibility
69
]
70

71
{ #category : #loading }
NEW
72
UserMetric >> loadCommitsSince: since until: until [
×
NEW
73

×
NEW
74
        | cacheSymbol allCommits |
×
NEW
75
        glhImporter withCommitDiffs: false.
×
NEW
76

×
NEW
77
        cacheSymbol := self
×
NEW
78
                               cacheSymbolFor: GLHCommit
×
NEW
79
                               since: since
×
NEW
80
                               until: until.
×
NEW
81

×
NEW
82
        "download commits unless project cache is not empty"
×
NEW
83
        allCommits := user contributedProjects collect: [ :project |
×
NEW
84
                              project repository
×
NEW
85
                                      cacheAt: cacheSymbol
×
NEW
86
                                      ifAbsentPut: [
×
NEW
87
                                              | foundCommits |
×
NEW
88
                                              foundCommits := glhImporter
×
NEW
89
                                                                      importCommitsOProject: project
×
NEW
90
                                                                      since: since
×
NEW
91
                                                                      until: until.
×
NEW
92
                                              foundCommits ] ].
×
NEW
93

×
NEW
94
        allCommits := allCommits flatten.
×
NEW
95
        allCommits do: [ :commit | glhImporter importCreatorOfCommit: commit ].
×
NEW
96
        glhImporter chainsCommitsFrom: allCommits.
×
NEW
97
        glhImporter withCommitDiffs: true.
×
NEW
98

×
NEW
99
        ^allCommits reject: [ :commit |
×
NEW
100
                                 commit commitCreator ~= user ]
×
NEW
101
]
×
102

103
{ #category : #loading }
NEW
104
UserMetric >> loadCompleteCommitsSince: since until: until [
×
NEW
105

×
NEW
106
        | commits |
×
NEW
107
        commits := self loadCommitsSince: since until: until.
×
NEW
108
        commits do: [ :commit | glhImporter completeImportedCommit: commit ].
×
NEW
109
        ^ commits
×
NEW
110
]
×
111

112
{ #category : #loading }
NEW
113
UserMetric >> loadCompleteMergeRequestsSince: since until: until [
×
NEW
114

×
NEW
115
        | mergeRequests |
×
NEW
116
        mergeRequests := self loadMergeRequestsSince: since until: until.
×
NEW
117

×
NEW
118
        mergeRequests do: [ :mergeRequest |
×
NEW
119
                glhImporter importMergeResquestMerger: mergeRequest ].
×
NEW
120

×
NEW
121
        ^ mergeRequests
×
NEW
122
]
×
123

124
{ #category : #loading }
NEW
125
UserMetric >> loadMergeRequestsSince: since until: until [
×
NEW
126

×
NEW
127
        | cacheSymbol mergeRequests |
×
NEW
128
        glhImporter withCommitDiffs: false.
×
NEW
129
        cacheSymbol := self
×
NEW
130
                               cacheSymbolFor: GLPHEMergeRequest
×
NEW
131
                               since: since
×
NEW
132
                               until: until.
×
NEW
133

×
NEW
134
        mergeRequests := user contributedProjects collect: [ :project |
×
NEW
135
                                 | mr |
×
NEW
136
                                 project cacheAt: cacheSymbol ifAbsentPut: [
×
NEW
137
                                         mr := glhImporter
×
NEW
138
                                                       importMergeRequests: project
×
NEW
139
                                                       since: since
×
NEW
140
                                                       until: until.
×
NEW
141
                                         mr ] ].
×
NEW
142

×
NEW
143
        mergeRequests := mergeRequests flattened.
×
NEW
144
        glhImporter withCommitDiffs: true.
×
NEW
145

×
NEW
146
        mergeRequests do: [ :mr | glhImporter importMergeResquestAuthor: mr ].
×
NEW
147

×
NEW
148
        ^mergeRequests select: [ :mergeRequest |
×
NEW
149
                                     mergeRequest author = user ].
×
NEW
150
]
×
151

152
{ #category : #loading }
NEW
153
UserMetric >> loadMergeRequestsWithJiraIssueSince: since until: until [
×
NEW
154

×
NEW
155
        | email mergeRequests |
×
NEW
156
        mergeRequests := self loadMergeRequestsSince: since until: until.
×
NEW
157

×
NEW
158
        email := self userEmail.
×
NEW
159

×
NEW
160
        jiraImporter importAllCurrentAndPastIssuesOf: email.
×
NEW
161

×
NEW
162
        GPJCConnector new
×
NEW
163
                gpModel: glhImporter glhModel;
×
NEW
164
                jiraModel: jiraImporter model;
×
NEW
165
                connect.
×
NEW
166

×
NEW
167
        ^ mergeRequests select: [ :mergeRequest |
×
NEW
168
                  mergeRequest jiraIssue isNotNil ]
×
NEW
169
]
×
170

171
{ #category : #accessing }
172
UserMetric >> name [
173

174
        ^ self subclassResponsibility
175
]
176

177
{ #category : #accessing }
178
UserMetric >> user: anObject [
×
179

×
180
        user := anObject
×
181
]
×
182

183
{ #category : #email }
NEW
184
UserMetric >> userEmail [
×
NEW
185
        ^ ('' join: {
×
NEW
186
                           user username.
×
NEW
187
                           emailDomain }) asLowercase
×
NEW
188
]
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc