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

moosetechnology / GitProjectHealth / 13372773799

17 Feb 2025 02:41PM UTC coverage: 62.03%. Remained the same
13372773799

Pull #130

github

web-flow
Merge 08e63bd1f into 8ff2bbfd9
Pull Request #130: create w new metric class

1464 of 2739 new or added lines in 38 files covered. (53.45%)

3 existing lines in 3 files now uncovered.

9624 of 15515 relevant lines covered (62.03%)

0.62 hits per line

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

77.3
/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 : #calculating }
14
UserMetric >> calculate [
15

16
        ^ self subclassResponsibility
17
]
18

19
{ #category : #accessing }
20
UserMetric >> description [
21

22
        ^ self subclassResponsibility
23
]
24

25
{ #category : #accessing }
NEW
26
UserMetric >> emailDomain: anObject [
×
NEW
27

×
NEW
28
        emailDomain := anObject
×
NEW
29
]
×
30

31
{ #category : #churn }
NEW
32
UserMetric >> foundSuccessorOf: commits andCompleteImportForMax: commitLimit [
×
NEW
33

×
NEW
34
        | analyzingCommits i size |
×
NEW
35
        analyzingCommits := Set new.
×
NEW
36
        glhImporter withCommitDiffs: true.
×
NEW
37

×
NEW
38
        commits do: [ :c |
×
NEW
39
                GitAnalyzer new
×
NEW
40
                        visitChildCommits: c childCommits
×
NEW
41
                        toStoreThemIn: analyzingCommits
×
NEW
42
                        upto: commitLimit ].
×
NEW
43

×
NEW
44
        i := 0.
×
NEW
45
        size := analyzingCommits size.
×
NEW
46
        analyzingCommits do: [ :c |
×
NEW
47

×
NEW
48
                glhImporter completeImportedCommit: c ].
×
NEW
49

×
NEW
50
        ^ analyzingCommits
×
NEW
51
]
×
52

53
{ #category : #initialization }
54
UserMetric >> initialize [
1✔
55
        over := Date
1✔
56
]
1✔
57

58
{ #category : #loading }
59
UserMetric >> load [
60

61
        ^ self subclassResponsibility
62
]
63

64
{ #category : #loading }
65
UserMetric >> loadCompleteMergeRequestsSince: since until: until [
1✔
66

1✔
67
        | mergeRequests |
1✔
68
        mergeRequests := self
1✔
69
                                 loadMergeRequestsSince: since until: until.
1✔
70

1✔
71
        mergeRequests do: [ :mergeRequest |
1✔
72
                glhImporter importMergeResquestMerger: mergeRequest.
1✔
73
                glhImporter importMergeRequestCommits: mergeRequest ].
1✔
74

1✔
75
        ^ mergeRequests
1✔
76
]
1✔
77

78
{ #category : #loading }
79
UserMetric >> loadMergeRequestsSince: since until: until [
1✔
80

1✔
81
        | cacheSymbol mergeRequests |
1✔
82
        glhImporter withCommitDiffs: false.
1✔
83
        cacheSymbol := self
1✔
84
                               cacheSymbolFor: GLHMergeRequest
1✔
85
                               since: since
1✔
86
                               until: until.
1✔
87

1✔
88
        mergeRequests := user contributedProjects collect: [ :project |
1✔
89
                                 | mr |
1✔
90
                                 project cacheAt: cacheSymbol ifAbsentPut: [
1✔
91
                                         mr := glhImporter
1✔
92
                                                       importMergeRequests: project
1✔
93
                                                       since: since
1✔
94
                                                       until: until.
1✔
95
                                         mr ] ].
1✔
96

1✔
97
        mergeRequests := mergeRequests flattened.
1✔
98
        glhImporter withCommitDiffs: true.
1✔
99

1✔
100
        mergeRequests do: [ :mr | glhImporter importMergeResquestAuthor: mr ].
1✔
101

1✔
102
        ^ mergeRequests "mergeRequests select: [ :mergeRequest |
1✔
103
                  mergeRequest author = user ]"
1✔
104
]
1✔
105

106
{ #category : #loading }
NEW
107
UserMetric >> loadMergeRequestsWithJiraIssueSince: since until: until [
×
NEW
108

×
NEW
109
        | email mergeRequests |
×
NEW
110
        mergeRequests := self
×
NEW
111
                                 loadMergeRequestsSince: since until:  until.
×
NEW
112

×
NEW
113
        email := self userEmail.
×
NEW
114

×
NEW
115
        jiraImporter importAllCurrentAndPastIssuesOf: email.
×
NEW
116

×
NEW
117
        GPJCConnector new
×
NEW
118
                gpModel: glhImporter glhModel;
×
NEW
119
                jiraModel: jiraImporter model;
×
NEW
120
                connect.
×
NEW
121

×
NEW
122
        ^ mergeRequests select: [ :mergeRequest |
×
NEW
123
                  mergeRequest jiraIssue isNotNil ]
×
NEW
124
]
×
125

126
{ #category : #loading }
127
UserMetric >> loadUserCommitsSince: since until: until [
1✔
128

1✔
129
        | cacheSymbol allCommits |
1✔
130
        glhImporter withCommitDiffs: false.
1✔
131

1✔
132
        cacheSymbol := self
1✔
133
                               cacheSymbolFor: GLHCommit
1✔
134
                               since: since
1✔
135
                               until: until.
1✔
136

1✔
137
        "download commits unless project cache is not empty"
1✔
138
        allCommits := user contributedProjects collect: [ :project |
1✔
139
                              project repository
1✔
140
                                      cacheAt: cacheSymbol
1✔
141
                                      ifAbsentPut: [
1✔
142
                                              | foundCommits |
1✔
143
                                              foundCommits := glhImporter
1✔
144
                                                                      importCommitsOfProject: project
1✔
145
                                                                      since: since
1✔
146
                                                                      until: until.
1✔
147
                                              foundCommits ] ].
1✔
148

1✔
149
        allCommits := allCommits flatten.
1✔
150
        allCommits do: [ :commit | glhImporter importCreatorOfCommit: commit ].
1✔
151
        glhImporter chainsCommitsFrom: allCommits.
1✔
152
        glhImporter withCommitDiffs: true.
1✔
153

1✔
154
        ^ allCommits reject: [ :commit | commit commitCreator ~= user ]
1✔
155
]
1✔
156

157
{ #category : #loading }
158
UserMetric >> loadUserCompleteCommitsSince: since until: until [
1✔
159

1✔
160
        | commits |
1✔
161
        commits := self loadUserCommitsSince: since until: until.
1✔
162
        commits do: [ :commit | glhImporter completeImportedCommit: commit ].
1✔
163
        ^ commits
1✔
164
]
1✔
165

166
{ #category : #loading }
167
UserMetric >> loadUserCompleteMergeRequestsSince: since until: until [
1✔
168

1✔
169
        | mergeRequests |
1✔
170
        mergeRequests := self loadUserMergeRequestsSince: since until: until.
1✔
171

1✔
172
        mergeRequests do: [ :mergeRequest |
1✔
173
                glhImporter importMergeResquestMerger: mergeRequest.
1✔
174
                glhImporter importMergeRequestCommits: mergeRequest ].
1✔
175

1✔
176
        ^ mergeRequests
1✔
177
]
1✔
178

179
{ #category : #loading }
180
UserMetric >> loadUserCompleteMergeRequestsWithJiraIssueSince: since until: until [
1✔
181

1✔
182
        | email mergeRequests |
1✔
183
        mergeRequests := self
1✔
184
                                 loadUserCompleteMergeRequestsSince: since
1✔
185
                                 until: until.
1✔
186

1✔
187
        email := self userEmail.
1✔
188

1✔
189
        jiraImporter importAllCurrentAndPastIssuesOf: email.
1✔
190

1✔
191
        GPJCConnector new
1✔
192
                gpModel: glhImporter glhModel;
1✔
193
                jiraModel: jiraImporter model;
1✔
194
                connect.
1✔
195

1✔
196
        ^ mergeRequests select: [ :mergeRequest |
1✔
197
                  mergeRequest jiraIssue isNotNil ]
1✔
198
]
1✔
199

200
{ #category : #loading }
201
UserMetric >> loadUserMergeRequestsSince: since until: until [
1✔
202

1✔
203
        | mergeRequests |
1✔
204
        mergeRequests := self loadMergeRequestsSince: since until: until.
1✔
205

1✔
206
        ^ mergeRequests select: [ :mergeRequest | mergeRequest author = user ]
1✔
207
]
1✔
208

209
{ #category : #loading }
210
UserMetric >> loadUserMergeRequestsWithJiraIssueSince: since until: until [
1✔
211

1✔
212
        | email mergeRequests |
1✔
213
        mergeRequests := self loadUserMergeRequestsSince: since until: until.
1✔
214

1✔
215
        email := self userEmail.
1✔
216

1✔
217
        jiraImporter importAllCurrentAndPastIssuesOf: email.
1✔
218

1✔
219
        GPJCConnector new
1✔
220
                gpModel: glhImporter glhModel;
1✔
221
                jiraModel: jiraImporter model;
1✔
222
                connect.
1✔
223

1✔
224
        ^ mergeRequests select: [ :mergeRequest |
1✔
225
                  mergeRequest jiraIssue isNotNil ]
1✔
226
]
1✔
227

228
{ #category : #accessing }
229
UserMetric >> user: anObject [
1✔
230

1✔
231
        user := anObject
1✔
232
]
1✔
233

234
{ #category : #email }
235
UserMetric >> userEmail [
1✔
236

1✔
237
        user public_email = '' ifFalse: [ ^ user public_email ].
1✔
238

1✔
239
        ^ ('' join: {
1✔
240
                           user username.
1✔
241
                           emailDomain }) asLowercase
1✔
242
]
1✔
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