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

moosetechnology / GitProjectHealth / 9549969001

17 Jun 2024 02:58PM UTC coverage: 26.896% (-2.6%) from 29.45%
9549969001

push

github

HLAD Nicolas
Merge 10a1182e1

1830 of 6804 relevant lines covered (26.9%)

0.27 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
}
10

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

×
81

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

×
88
        commitShape add: (self shapeForCommit: aCommit).
×
89

×
90
        self allChildrenShapesFrom: aCommit into: dic.
×
91
        children addAll: dic values.
×
92

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

×
100
        shape2change do: [ :composite |
×
101
                (composite children select: [ :b | b class = RSBox ]) color:
×
102
                        Color red ].
×
103

×
104
        parents addAll: (aCommit parentCommits collect: [ :c |
×
105
                         self shapeForCommit: c withColor: self parentColor ]).
×
106

×
107
        allCommitShps := parents , commitShape , children.
×
108

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

×
120

×
121

×
122
        "canvas addAllShapes: commitShape , parents , children."
×
123
        self createLinesBetweenCommits: allCommitShps.
×
124

×
125
        canvas addAll: allCommitShps.
×
126
        RSHorizontalTreeLayout new on: canvas nodes.
×
127

×
128
        canvas @ RSCanvasController.
×
129

×
130
        ^ canvas
×
131
]
×
132

133
{ #category : #canvas }
134
RSCommit >> buildCommitDiffFileImpact [
×
135

×
136
        | shapes |
×
137
        canvas := RSCanvas new.
×
138
        shapes := RSGroup new.
×
139

×
140

×
141
        aCommit diffsGroup do: [ :diff |
×
142
                shapes add:
×
143
                        (RSCommitDiff new
×
144
                                 shapeForDiffRange: diff
×
145
                                 withColor: Color lightBlue) ].
×
146

×
147

×
148

×
149
        RSVerticalLineLayout  new
×
150
                gapSize: 5;
×
151
                on: shapes.
×
152

×
153

×
154
        canvas addAllShapes: shapes.
×
155
        canvas @ RSCanvasController.
×
156

×
157
        ^ canvas
×
158
]
×
159

160
{ #category : #canvas }
161
RSCommit >> buildCommitHierachyCanvas [
×
162
        "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. "
×
163

×
164
        | shapes parents children commitShape group |
×
165
        canvas := RSCanvas new.
×
166
        shapes := RSGroup new.
×
167
        parents := RSGroup new.
×
168
        children := RSGroup new.
×
169
        commitShape := RSGroup new.
×
170

×
171

×
172
        commitShape add: (self shapeForCommit: aCommit).
×
173

×
174
        children addAll: (aCommit childCommits collect: [ :c |
×
175
                         self shapeForCommit: c withColor: self childColor ]).
×
176

×
177
        RSVerticalLineLayout new
×
178
                alignCenter;
×
179
                gapSize: 100;
×
180
                on: children.
×
181

×
182
        parents addAll: (aCommit parentCommits collect: [ :c |
×
183
                         self shapeForCommit: c withColor: self parentColor ]).
×
184

×
185
        RSVerticalLineLayout new
×
186
                alignCenter;
×
187
                gapSize: 100;
×
188
                on: parents.
×
189

×
190
        "canvas addAllShapes: commitShape , parents , children."
×
191
        self createLinesBetweenCommits: commitShape , parents , children.
×
192

×
193
        group := RSGroup new
×
194
                         add: parents;
×
195
                         add: commitShape;
×
196
                         add: children;
×
197
                         yourself.
×
198

×
199
        RSHorizontalLineLayout new
×
200
                gapSize: 100;
×
201
                on: group.
×
202

×
203

×
204
        "canvas addShape: (RSComposite new
×
205
                         shapes: group;
×
206
                         updateConnectedLines;
×
207
                         yourself)."
×
208

×
209
        canvas addAll: commitShape , parents , children.
×
210
        self createLinesBetweenCommits: commitShape , parents , children.
×
211

×
212
        canvas @ RSCanvasController.
×
213

×
214
        ^ canvas
×
215
]
×
216

217
{ #category : #shape }
218
RSCommit >> buildCompositeLayer: shapes withName: name withColor: color [
×
219

×
220
        | shapesCompo label boxGroup |
×
221
        boxGroup := RSGroup new.
×
222
        label := RSLabel new
×
223
                         text: name;
×
224
                         fontSize: 50;
×
225
                         bold;
×
226
                         yourself.
×
227

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

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

×
241
        ^ RSComposite new
×
242
                  shapes: boxGroup;
×
243
                 " model: shapes;"
×
244
                  color: (color alpha: 0.1);
×
245
                  popup;
×
246
                  yourself
×
247
]
×
248

249
{ #category : #canvas }
250
RSCommit >> buildDiffCanvas [
×
251

×
252
        | shapes parents children commitShape group |
×
253
        canvas := RSCanvas new.
×
254
        shapes := RSGroup new.
×
255
        parents := RSGroup new.
×
256
        children := RSGroup new.
×
257
        commitShape := RSGroup new.
×
258

×
259
        commitShape add: (self shapeForCommit: aCommit).
×
260

×
261
        children addAll: (aCommit childCommits collect: [ :c |
×
262
                         self shapeForCommit: c withColor: self childColor ]).
×
263

×
264
        RSVerticalLineLayout new
×
265
                alignCenter;
×
266
                gapSize: 100;
×
267
                on: children.
×
268

×
269
        parents addAll: (aCommit parentCommits collect: [ :c |
×
270
                         self shapeForCommit: c withColor: self parentColor ]).
×
271

×
272
        RSVerticalLineLayout new
×
273
                alignCenter;
×
274
                gapSize: 100;
×
275
                on: parents.
×
276

×
277
        "canvas addAllShapes: commitShape , parents , children."
×
278
        self createLinesBetweenCommits: commitShape , parents , children.
×
279

×
280
        group := RSGroup new
×
281
                         add: parents;
×
282
                         add: commitShape;
×
283
                         add: children;
×
284
                         yourself.
×
285

×
286
        RSHorizontalLineLayout new
×
287
                gapSize: 100;
×
288
                on: group.
×
289

×
290

×
291

×
292
        "canvas addShape: (RSComposite new
×
293
                         shapes: group;
×
294
                         updateConnectedLines;
×
295
                         yourself)."
×
296

×
297
        canvas addAll: commitShape , parents , children.
×
298
        self createLinesBetweenCommits: commitShape , parents , children.
×
299

×
300
        canvas @ RSCanvasController.
×
301

×
302
        ^ canvas
×
303
]
×
304

305
{ #category : #color }
306
RSCommit >> childColor [
×
307

×
308
        ^ Color lightGreen
×
309
]
×
310

311
{ #category : #accessing }
312
RSCommit >> commit: aGLHCommit [
×
313
        aCommit := aGLHCommit 
×
314

×
315
]
×
316

317
{ #category : #color }
318
RSCommit >> commitColor [
×
319

×
320
        ^ Color blue
×
321
]
×
322

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

×
335
        RSVerticalLineLayout new
×
336
                alignCenter;
×
337
                gapSize: 100;
×
338
                on: children.
×
339
                
×
340
                children 
×
341
                
×
342
                 ]) reject: #nil).
×
343

×
344
                
×
345
        ^ group 
×
346
]
×
347

348
{ #category : #lines }
349
RSCommit >> createLinesBetweenCommits [
×
350

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

360
{ #category : #lines }
361
RSCommit >> createLinesBetweenCommits: shapes [
×
362

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

372
{ #category : #color }
373
RSCommit >> defaultColor [
×
374

×
375
        ^ Color lightOrange 
×
376
]
×
377

378
{ #category : #initialization }
379
RSCommit >> initialize [ 
×
380
        canvas := RSCanvas new.
×
381
        aCommit := GLHCommit new. 
×
382
]
×
383

384
{ #category : #color }
385
RSCommit >> parentColor [
×
386

×
387
        ^ Color gray
×
388
]
×
389

390
{ #category : #shape }
391
RSCommit >> shapeForCommit: aGLHCommit [
×
392

×
393
        ^ self shapeForCommit: aGLHCommit withColor: self defaultColor.
×
394
]
×
395

396
{ #category : #shape }
397
RSCommit >> shapeForCommit: aGLHCommit withColor: color [
×
398

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

×
406
        labelCommiter := RSLabel new
×
407
                                 text: 'by ',
×
408
                                         (aGLHCommit author_name truncateWithElipsisTo: 50);
×
409
                                 yourself.
×
410

×
411
        box := RSBox new
×
412
                       height: 50;
×
413
                       width: 60;
×
414
                       color: color.
×
415

×
416
        group
×
417
                add: labelTitle;
×
418
                add: box;
×
419
                add: labelCommiter.
×
420

×
421
        RSVerticalLineLayout new alignCenter on: group.
×
422

×
423
        ^ RSComposite new
×
424
                  shapes: group;
×
425
                  model: aGLHCommit;
×
426
                  popup;
×
427
                  draggable;
×
428
                  yourself
×
429
]
×
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