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

moosetechnology / GitProjectHealth / 10880677211

16 Sep 2024 09:01AM UTC coverage: 20.332% (-0.2%) from 20.538%
10880677211

push

github

web-flow
Merge pull request #54 from moosetechnology/metrics-fixing

Metrics fixing

0 of 178 new or added lines in 19 files covered. (0.0%)

18 existing lines in 6 files now uncovered.

1961 of 9645 relevant lines covered (20.33%)

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 }
113
UserMetric >> loadCompleteMergeRequestsSince: since until: until [
×
114

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

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

×
121
        ^ mergeRequests
×
122
]
×
123

124
{ #category : #loading }
NEW
125
UserMetric >> loadMergeRequestsOfUser: anUser since: 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 := anUser 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 | mergeRequest author = anUser ]
×
NEW
149
]
×
150

151
{ #category : #loading }
152
UserMetric >> loadMergeRequestsSince: since until: until [
×
153

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

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

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

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

×
NEW
175
        ^ mergeRequests "select: [ :mergeRequest | mergeRequest author = user ]"
×
176
]
×
177

178
{ #category : #loading }
179
UserMetric >> loadMergeRequestsWithJiraIssueSince: since until: until [
×
180

×
181
        | email mergeRequests |
×
182
        mergeRequests := self loadMergeRequestsSince: since until: until.
×
183

×
184
        email := self userEmail.
×
185

×
186
        jiraImporter importAllCurrentAndPastIssuesOf: email.
×
187

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

×
193
        ^ mergeRequests select: [ :mergeRequest |
×
194
                  mergeRequest jiraIssue isNotNil ]
×
195
]
×
196

197
{ #category : #accessing }
198
UserMetric >> name [
199

200
        ^ self subclassResponsibility
201
]
202

203
{ #category : #accessing }
204
UserMetric >> user: anObject [
×
205

×
206
        user := anObject
×
207
]
×
208

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

© 2025 Coveralls, Inc