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

moosetechnology / GitProjectHealth / 11163879852

03 Oct 2024 02:24PM UTC coverage: 58.906% (+25.2%) from 33.667%
11163879852

push

github

web-flow
Merge pull request #75 from moosetechnology/develop

V1.0.0

6210 of 8212 new or added lines in 80 files covered. (75.62%)

130 existing lines in 6 files now uncovered.

8903 of 15114 relevant lines covered (58.91%)

0.59 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

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

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

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

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

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

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

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

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

×
122

×
123

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

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

×
130
        canvas @ RSCanvasController.
×
131

×
132
        ^ canvas
×
133
]
×
134

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

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

×
142

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

×
149

×
150

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

×
155

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

×
159
        ^ canvas
×
160
]
×
161

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

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

×
173

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

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

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

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

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

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

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

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

×
205

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

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

×
214
        canvas @ RSCanvasController.
×
215

×
216
        ^ canvas
×
217
]
×
218

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

×
292

×
293

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

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

×
302
        canvas @ RSCanvasController.
×
303

×
304
        ^ canvas
×
305
]
×
306

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

×
310
        ^ Color lightGreen
×
311
]
×
312

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

×
317
]
×
318

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

×
322
        ^ Color blue
×
323
]
×
324

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

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

×
346
                
×
347
        ^ group 
×
348
]
×
349

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

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

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

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

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

×
377
        ^ Color lightOrange 
×
378
]
×
379

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

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

×
389
        ^ Color gray
×
390
]
×
391

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

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

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

×
401
        | box group labelTitle labelCommiter impactedFiles |
×
402
        group := RSGroup new.
×
403
        impactedFiles := RSGroup new.
×
404
        labelTitle := RSLabel new
×
NEW
405
                              text: (aGLHCommit message ifNil: [ (aGLHCommit id truncateWithElipsisTo: 7) printString ] ifNotNil: [ aGLHCommit message truncateWithElipsisTo: 40] );
×
406
                              yourself.
×
407

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

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

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

×
425
        RSVerticalLineLayout new alignCenter on: group.
×
426

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