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

moosetechnology / GitProjectHealth / 10918907131

18 Sep 2024 08:57AM UTC coverage: 20.103% (-0.2%) from 20.328%
10918907131

push

github

web-flow
Merge pull request #61 from moosetechnology/feat-jira-time-vs-merge-request-time

feat: add jira time and merge request time difference metric

0 of 207 new or added lines in 11 files covered. (0.0%)

4 existing lines in 2 files now uncovered.

1961 of 9755 relevant lines covered (20.1%)

0.2 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 }
33
UserMetric >> emailDomain: anObject [
×
34

×
35
        emailDomain := anObject
×
36
]
×
37

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

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

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

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

×
55
                glhImporter completeImportedCommit: c ].
×
56

×
57
        ^ analyzingCommits
×
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 }
72
UserMetric >> loadCommitsSince: since until: until [
×
73

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

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

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

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

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

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

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

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

×
115
        | mergeRequests |
×
NEW
116
        mergeRequests := self
×
NEW
117
                                 loadMergeRequestsOfUser: anUser
×
NEW
118
                                 since: since
×
NEW
119
                                 until: until.
×
120

×
121
        mergeRequests do: [ :mergeRequest |
×
NEW
122
                glhImporter importMergeResquestMerger: mergeRequest.
×
NEW
123
                glhImporter importMergeRequestCommits: mergeRequest ].
×
124

×
125
        ^ mergeRequests
×
126
]
×
127

128
{ #category : #loading }
NEW
129
UserMetric >> loadCompleteMergeRequestsWithJiraIssueOfUser: anUser since: since until: until [
×
130

×
NEW
131
        | email mergeRequests |
×
NEW
132
        mergeRequests := self
×
NEW
133
                                 loadCompleteMergeRequestsOfUser:  anUser
×
NEW
134
                                 since: since
×
NEW
135
                                 until: until.
×
136

×
NEW
137
        email := self userEmail.
×
138

×
NEW
139
        jiraImporter importAllCurrentAndPastIssuesOf: email.
×
140

×
NEW
141
        GPJCConnector new
×
NEW
142
                gpModel: glhImporter glhModel;
×
NEW
143
                jiraModel: jiraImporter model;
×
NEW
144
                connect.
×
145

×
NEW
146
        ^ mergeRequests select: [ :mergeRequest |
×
NEW
147
                  mergeRequest jiraIssue isNotNil ]
×
UNCOV
148
]
×
149

150
{ #category : #loading }
NEW
151
UserMetric >> loadMergeRequestsOfUser: anUser since: since until: until [ 
×
152

×
153
        | cacheSymbol mergeRequests |
×
154
        glhImporter withCommitDiffs: false.
×
155
        cacheSymbol := self
×
156
                               cacheSymbolFor: GLPHEMergeRequest
×
157
                               since: since
×
158
                               until: until.
×
159

×
NEW
160
        mergeRequests := anUser contributedProjects collect: [ :project |
×
161
                                 | mr |
×
162
                                 project cacheAt: cacheSymbol ifAbsentPut: [
×
163
                                         mr := glhImporter
×
164
                                                       importMergeRequests: project
×
165
                                                       since: since
×
166
                                                       until: until.
×
167
                                         mr ] ].
×
168

×
169
        mergeRequests := mergeRequests flattened.
×
170
        glhImporter withCommitDiffs: true.
×
171

×
172
        mergeRequests do: [ :mr | glhImporter importMergeResquestAuthor: mr ].
×
173

×
NEW
174
        ^ mergeRequests select: [ :mergeRequest | mergeRequest author = anUser ]
×
175
]
×
176

177
{ #category : #loading }
NEW
178
UserMetric >> loadMergeRequestsWithJiraIssueOfUser: anUser since: since until: until [
×
179

×
180
        | email mergeRequests |
×
NEW
181
        mergeRequests := self
×
NEW
182
                                 loadMergeRequestsOfUser: anUser
×
NEW
183
                                 since: since
×
NEW
184
                                 until: until.
×
185

×
186
        email := self userEmail.
×
187

×
188
        jiraImporter importAllCurrentAndPastIssuesOf: email.
×
189

×
190
        GPJCConnector new
×
191
                gpModel: glhImporter glhModel;
×
192
                jiraModel: jiraImporter model;
×
193
                connect.
×
194

×
195
        ^ mergeRequests select: [ :mergeRequest |
×
196
                  mergeRequest jiraIssue isNotNil ]
×
197
]
×
198

199
{ #category : #accessing }
200
UserMetric >> name [
201

202
        ^ self subclassResponsibility
203
]
204

205
{ #category : #accessing }
206
UserMetric >> user: anObject [
×
207

×
208
        user := anObject
×
209
]
×
210

211
{ #category : #email }
212
UserMetric >> userEmail [
×
213
        ^ ('' join: {
×
214
                           user username.
×
215
                           emailDomain }) asLowercase
×
216
]
×
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