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

moosetechnology / GitProjectHealth / 10869973365

15 Sep 2024 09:42AM UTC coverage: 36.283% (+2.6%) from 33.667%
10869973365

Pull #55

github

web-flow
Merge f5384a57d into 48c9c9c78
Pull Request #55: Agg generic importer and improve github importer

355 of 461 new or added lines in 7 files covered. (77.01%)

224 existing lines in 3 files now uncovered.

3063 of 8442 relevant lines covered (36.28%)

0.36 hits per line

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

0.0
/src/GitLabHealth-Visualization/RSCommit.class.st
1
Class {
2
        #name : 'RSCommit',
3
        #superclass : 'Object',
4
        #instVars : [
5
                'aCommit',
6
                'canvas'
7
        ],
8
        #category : 'GitLabHealth-Visualization',
9
        #package : 'GitLabHealth-Visualization'
10
}
11

12
{ #category : 'as yet unclassified' }
13
RSCommit class >> canvasCompleteHierachyFor: aGLHCommit [
×
14

×
15
        ^ self new
×
16
                  commit: aGLHCommit;
×
17
                  buildCommitCompleteHierachyCanvas 
×
18
]
×
19

20
{ #category : 'as yet unclassified' }
21
RSCommit class >> canvasDiffImpactFor: aGLHCommit [
×
22

×
23
        ^ self new
×
24
                  commit: aGLHCommit;
×
25
                  buildCommitDiffFileImpact
×
26
]
×
27

28
{ #category : 'as yet unclassified' }
29
RSCommit class >> canvasHierarchyFor: aGLHCommit [
×
30

×
31
        ^ self new
×
32
                  commit: aGLHCommit;
×
33
                  buildCommitHierachyCanvas
×
34
]
×
35

36
{ #category : 'shape' }
37
RSCommit >> allChildrenShapesFrom: aGLHCommit [
×
38

×
39
        | children sum |
×
40
        children := RSGroup new.
×
41
        sum := RSGroup new.
×
42

×
43
        
×
44
        children addAll: (aGLHCommit childCommits collect: [ :child |
×
45
                         self shapeForCommit: child ]).
×
46

×
47
        "^ children
×
48
          ,
×
49
                  ((children collect: [ :commit |
×
50
                           self allChildrenShapesFrom: commit model ]) flattened)" 
×
51
        sum := ((children collect: [ :commit |
×
52
                           self allChildrenShapesFrom: commit model ]) flattened).
×
53
        
×
54
        ^ children, sum . 
×
55
]
×
56

57
{ #category : 'shape' }
58
RSCommit >> allChildrenShapesFrom: aGLHCommit into: dic [
×
59

×
60
        | children sum |
×
61
        children := RSGroup new.
×
62
        sum := RSGroup new.
×
63

×
64
        children addAll: (aGLHCommit childCommits collect: [ :child |
×
65
                         dic at: child put: (self shapeForCommit: child withColor: self childColor) ]).
×
66

×
67
        (children do: [ :commit |
×
68
                 self allChildrenShapesFrom: commit model into: dic ]) flattened
×
69
]
×
70

71
{ #category : 'canvas' }
72
RSCommit >> buildCommitCompleteHierachyCanvas [
×
73

×
74
        | shapes parents children commitShape dic churnAnalyzer files2Commits shape2change allCommitShps |
×
75
        canvas := RSCanvas new.
×
76
        shapes := RSGroup new.
×
77
        parents := RSGroup new.
×
78
        children := RSGroup new.
×
79
        commitShape := RSGroup new.
×
80
        dic := Dictionary new.
×
81

×
82

×
NEW
83
        churnAnalyzer := GitAnalyzer new
×
NEW
84
                                 fromCommit: aCommit;
×
NEW
85
                                 maxChildCommit: 50.
×
86
        files2Commits := churnAnalyzer impactedFilesInFollowUpCommitsOf:
×
87
                                 aCommit.
×
88
        files2Commits := files2Commits select: [ :entry |
×
89
                                 entry value isNotNil ].
×
90

×
91
        commitShape add: (self shapeForCommit: aCommit).
×
92

×
93
        self allChildrenShapesFrom: aCommit into: dic.
×
94
        children addAll: dic values.
×
95

×
96
        shape2change := (children collect: [ :shape |
×
97
                                 ((files2Commits values collect: [ :group |
×
98
                                           group asDictionary
×
99
                                                   at: shape model
×
100
                                                   ifPresent: [ shape ] ]) reject: #isNil) asSet ])
×
101
                                flattened.
×
102

×
103
        shape2change do: [ :composite |
×
104
                (composite children select: [ :b | b class = RSBox ]) color:
×
105
                        Color red ].
×
106

×
107
        parents addAll: (aCommit parentCommits collect: [ :c |
×
108
                         self shapeForCommit: c withColor: self parentColor ]).
×
109

×
110
        allCommitShps := parents , commitShape , children.
×
111

×
112
        allCommitShps do: [ :shp |
×
113
                | commit |
×
114
                commit := shp model.
×
115
                commit commitCreator = commitShape first model commitCreator
×
116
                        ifTrue: [
×
117
                                (shp children detect: [ :c | c class = RSBox ]) border:
×
118
                                        (RSBorder new
×
119
                                                 width: 5;
×
120
                                                 color: self defaultColor;
×
121
                                                 yourself) ] ].
×
122

×
123

×
124

×
125
        "canvas addAllShapes: commitShape , parents , children."
×
126
        self createLinesBetweenCommits: allCommitShps.
×
127

×
128
        canvas addAll: allCommitShps.
×
129
        RSHorizontalTreeLayout new on: canvas nodes.
×
130

×
131
        canvas @ RSCanvasController.
×
132

×
133
        ^ canvas
×
134
]
×
135

136
{ #category : 'canvas' }
137
RSCommit >> buildCommitDiffFileImpact [
×
138

×
139
        | shapes |
×
140
        canvas := RSCanvas new.
×
141
        shapes := RSGroup new.
×
142

×
143

×
144
        aCommit diffsGroup do: [ :diff |
×
145
                shapes add:
×
146
                        (RSCommitDiff new
×
147
                                 shapeForDiffRange: diff
×
148
                                 withColor: Color lightBlue) ].
×
149

×
150

×
151

×
152
        RSVerticalLineLayout  new
×
153
                gapSize: 5;
×
154
                on: shapes.
×
155

×
156

×
157
        canvas addAllShapes: shapes.
×
158
        canvas @ RSCanvasController.
×
159

×
160
        ^ canvas
×
161
]
×
162

163
{ #category : 'canvas' }
164
RSCommit >> buildCommitHierachyCanvas [
×
165
        "build the commit graph from a starting root commit toward all of the descendants (children commit). Regardless of branches. Also display in red border the following commits that touch on the same files commited by the root commit. "
×
166

×
167
        | shapes parents children commitShape group |
×
168
        canvas := RSCanvas new.
×
169
        shapes := RSGroup new.
×
170
        parents := RSGroup new.
×
171
        children := RSGroup new.
×
172
        commitShape := RSGroup new.
×
173

×
174

×
175
        commitShape add: (self shapeForCommit: aCommit).
×
176

×
177
        children addAll: (aCommit childCommits collect: [ :c |
×
178
                         self shapeForCommit: c withColor: self childColor ]).
×
179

×
180
        RSVerticalLineLayout new
×
181
                alignCenter;
×
182
                gapSize: 100;
×
183
                on: children.
×
184

×
185
        parents addAll: (aCommit parentCommits collect: [ :c |
×
186
                         self shapeForCommit: c withColor: self parentColor ]).
×
187

×
188
        RSVerticalLineLayout new
×
189
                alignCenter;
×
190
                gapSize: 100;
×
191
                on: parents.
×
192

×
193
        "canvas addAllShapes: commitShape , parents , children."
×
194
        self createLinesBetweenCommits: commitShape , parents , children.
×
195

×
196
        group := RSGroup new
×
197
                         add: parents;
×
198
                         add: commitShape;
×
199
                         add: children;
×
200
                         yourself.
×
201

×
202
        RSHorizontalLineLayout new
×
203
                gapSize: 100;
×
204
                on: group.
×
205

×
206

×
207
        "canvas addShape: (RSComposite new
×
208
                         shapes: group;
×
209
                         updateConnectedLines;
×
210
                         yourself)."
×
211

×
212
        canvas addAll: commitShape , parents , children.
×
213
        self createLinesBetweenCommits: commitShape , parents , children.
×
214

×
215
        canvas @ RSCanvasController.
×
216

×
217
        ^ canvas
×
218
]
×
219

220
{ #category : 'shape' }
221
RSCommit >> buildCompositeLayer: shapes withName: name withColor: color [
×
222

×
223
        | shapesCompo label boxGroup |
×
224
        boxGroup := RSGroup new.
×
225
        label := RSLabel new
×
226
                         text: name;
×
227
                         fontSize: 50;
×
228
                         bold;
×
229
                         yourself.
×
230

×
231
        RSVerticalLineLayout on: shapes.
×
232
        shapesCompo := RSComposite new
×
233
                               shapes: shapes;
×
234
                               yourself.
×
235
        "shapes do: [ :shp | canvas removeShape: shp ]."
×
236
        shapesCompo extent: shapesCompo extent + 5.
×
237

×
238
        "create the group for one class and its method"
×
239
        boxGroup
×
240
                add: label;
×
241
                add: shapesCompo.
×
242
        RSVerticalLineLayout new alignCenter on: boxGroup.
×
243

×
244
        ^ RSComposite new
×
245
                  shapes: boxGroup;
×
246
                 " model: shapes;"
×
247
                  color: (color alpha: 0.1);
×
248
                  popup;
×
249
                  yourself
×
250
]
×
251

252
{ #category : 'canvas' }
253
RSCommit >> buildDiffCanvas [
×
254

×
255
        | shapes parents children commitShape group |
×
256
        canvas := RSCanvas new.
×
257
        shapes := RSGroup new.
×
258
        parents := RSGroup new.
×
259
        children := RSGroup new.
×
260
        commitShape := RSGroup new.
×
261

×
262
        commitShape add: (self shapeForCommit: aCommit).
×
263

×
264
        children addAll: (aCommit childCommits collect: [ :c |
×
265
                         self shapeForCommit: c withColor: self childColor ]).
×
266

×
267
        RSVerticalLineLayout new
×
268
                alignCenter;
×
269
                gapSize: 100;
×
270
                on: children.
×
271

×
272
        parents addAll: (aCommit parentCommits collect: [ :c |
×
273
                         self shapeForCommit: c withColor: self parentColor ]).
×
274

×
275
        RSVerticalLineLayout new
×
276
                alignCenter;
×
277
                gapSize: 100;
×
278
                on: parents.
×
279

×
280
        "canvas addAllShapes: commitShape , parents , children."
×
281
        self createLinesBetweenCommits: commitShape , parents , children.
×
282

×
283
        group := RSGroup new
×
284
                         add: parents;
×
285
                         add: commitShape;
×
286
                         add: children;
×
287
                         yourself.
×
288

×
289
        RSHorizontalLineLayout new
×
290
                gapSize: 100;
×
291
                on: group.
×
292

×
293

×
294

×
295
        "canvas addShape: (RSComposite new
×
296
                         shapes: group;
×
297
                         updateConnectedLines;
×
298
                         yourself)."
×
299

×
300
        canvas addAll: commitShape , parents , children.
×
301
        self createLinesBetweenCommits: commitShape , parents , children.
×
302

×
303
        canvas @ RSCanvasController.
×
304

×
305
        ^ canvas
×
306
]
×
307

308
{ #category : 'color' }
309
RSCommit >> childColor [
×
310

×
311
        ^ Color lightGreen
×
312
]
×
313

314
{ #category : 'accessing' }
315
RSCommit >> commit: aGLHCommit [
×
316
        aCommit := aGLHCommit 
×
317

×
318
]
×
319

320
{ #category : 'color' }
321
RSCommit >> commitColor [
×
322

×
323
        ^ Color blue
×
324
]
×
325

326
{ #category : 'shape' }
327
RSCommit >> createChildrenGroupFor: aGLHCommit [ 
×
328
        |group|
×
329
        group := RSGroup new. 
×
330
        
×
331
        group add: ((aGLHCommit childCommits collect: [ :child |
×
332
                |children|
×
333
        children := RSGroup new. 
×
334
        
×
335
        children addAll: (child childCommits collect: [ :c |
×
336
                         self shapeForCommit: c withColor: self childColor ]).
×
337

×
338
        RSVerticalLineLayout new
×
339
                alignCenter;
×
340
                gapSize: 100;
×
341
                on: children.
×
342
                
×
343
                children 
×
344
                
×
345
                 ]) reject: #nil).
×
346

×
347
                
×
348
        ^ group 
×
349
]
×
350

351
{ #category : 'lines' }
352
RSCommit >> createLinesBetweenCommits [
×
353

×
354
        (RSLineBuilder arrowedLine
×
355
                 withBorderAttachPoint;
×
356
                 color: (Color gray alpha: 0.9);
×
357
                 shapes: canvas shapes;
×
358
                canvas: canvas;
×
359
                 beDirectional;
×
360
                 connectToAll: [ :commit | commit childCommits ]) pushBack
×
361
]
×
362

363
{ #category : 'lines' }
364
RSCommit >> createLinesBetweenCommits: shapes [
×
365

×
366
        (RSLineBuilder arrowedLine
×
367
                withBorderAttachPoint;
×
368
                color: Color black;
×
369
                canvas: canvas;
×
370
                shapes: shapes;
×
371
                beDirectional;
×
372
                connectToAll: [ :commit | commit childCommits ]) pushFront 
×
373
]
×
374

375
{ #category : 'color' }
376
RSCommit >> defaultColor [
×
377

×
378
        ^ Color lightOrange 
×
379
]
×
380

381
{ #category : 'initialization' }
382
RSCommit >> initialize [ 
×
383
        canvas := RSCanvas new.
×
384
        aCommit := GLHCommit new. 
×
385
]
×
386

387
{ #category : 'color' }
388
RSCommit >> parentColor [
×
389

×
390
        ^ Color gray
×
391
]
×
392

393
{ #category : 'shape' }
394
RSCommit >> shapeForCommit: aGLHCommit [
×
395

×
396
        ^ self shapeForCommit: aGLHCommit withColor: self defaultColor.
×
397
]
×
398

399
{ #category : 'shape' }
400
RSCommit >> shapeForCommit: aGLHCommit withColor: color [
×
401

×
402
        | box group labelTitle labelCommiter impactedFiles |
×
403
        group := RSGroup new.
×
404
        impactedFiles := RSGroup new.
×
405
        labelTitle := RSLabel new
×
406
                              text: (aGLHCommit name truncateWithElipsisTo: 40);
×
407
                              yourself.
×
408

×
409
        labelCommiter := RSLabel new
×
NEW
410
                                 text: 'by ' , (aGLHCommit author_name
×
NEW
411
                                                          ifNil: [ 'unknown' ]
×
NEW
412
                                                          ifNotNil: [ :authorName |
×
NEW
413
                                                                  authorName truncateWithElipsisTo: 50 ]);
×
414
                                 yourself.
×
415

×
416
        box := RSBox new
×
417
                       height: 50;
×
418
                       width: 60;
×
419
                       color: color.
×
420

×
421
        group
×
422
                add: labelTitle;
×
423
                add: box;
×
424
                add: labelCommiter.
×
425

×
426
        RSVerticalLineLayout new alignCenter on: group.
×
427

×
428
        ^ RSComposite new
×
429
                  shapes: group;
×
430
                  model: aGLHCommit;
×
431
                  popup;
×
432
                  draggable;
×
433
                  yourself
×
434
]
×
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