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

moosetechnology / MooseIDE / 22714469042

05 Mar 2026 10:51AM UTC coverage: 65.862% (-0.06%) from 65.926%
22714469042

push

github

web-flow
Merge pull request #1596 from moosetechnology/bulk-editing

improvement to BulkEditing

0 of 34 new or added lines in 1 file covered. (0.0%)

204 existing lines in 18 files now uncovered.

21882 of 33224 relevant lines covered (65.86%)

1.32 hits per line

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

0.0
/src/MooseIDE-Core-Reporter/MiModelReportModel.class.st
1
"
2
The spec model for the `MiModelReport`
3

4
Responsible for actually generating the report
5
"
6
Class {
7
        #name : 'MiModelReportModel',
8
        #superclass : 'MiAbstractModel',
9
        #instVars : [
10
                'mooseModel',
11
                'settings',
12
                'report',
13
                'largeClassThreshold',
14
                'longClassThreshold',
15
                'dataClassThreshold',
16
                'longMethodThreshold',
17
                'complexMethodThreshold',
18
                'excessiveAPIThreshold'
19
        ],
20
        #category : 'MooseIDE-Core-Reporter',
21
        #package : 'MooseIDE-Core-Reporter'
22
}
23

24
{ #category : 'as yet unclassified' }
25
MiModelReportModel class >> defaultComplexMethodThreshold [
×
26

×
27
        ^ 50
×
UNCOV
28
]
×
29

30
{ #category : 'accessing' }
31
MiModelReportModel class >> defaultConfiguration [
×
32

×
33
        ^ MiModelReportSettingsConfiguration new
×
34
                  largeClassThreshold: self defaultLargeClassThreshold;
×
35
                  longClassThreshold: self defaultLongClassThreshold;
×
36
                  dataClassThreshold: self defaultDataClassThreshold;
×
37
                  longMethodThreshold: self defaultLongMethodThreshold;
×
38
                  complexMethodThreshold: self defaultComplexMethodThreshold;
×
39
                  excessiveAPIThreshold: self defaultExcessiveAPIThreshold;
×
40
                  yourself
×
UNCOV
41
]
×
42

43
{ #category : 'as yet unclassified' }
44
MiModelReportModel class >> defaultDataClassThreshold [
×
45

×
46
        ^ 10
×
UNCOV
47
]
×
48

49
{ #category : 'as yet unclassified' }
50
MiModelReportModel class >> defaultExcessiveAPIThreshold [
×
51

×
52
        ^ 5
×
UNCOV
53
]
×
54

55
{ #category : 'as yet unclassified' }
56
MiModelReportModel class >> defaultLargeClassThreshold [
×
57

×
58
        ^ 100
×
UNCOV
59
]
×
60

61
{ #category : 'as yet unclassified' }
62
MiModelReportModel class >> defaultLongClassThreshold [
×
63

×
64
        ^ 1000
×
UNCOV
65
]
×
66

67
{ #category : 'as yet unclassified' }
68
MiModelReportModel class >> defaultLongMethodThreshold [
×
69

×
70
        ^ 100
×
UNCOV
71
]
×
72

73
{ #category : 'microdown' }
74
MiModelReportModel >> bulletList: aCollection [
×
75

×
76
        aCollection do: [ :line |
×
77
                report
×
78
                        << '- ' ;
×
79
                        << line ;
×
80
                        cr
×
81
        ].
×
82
        report cr
×
UNCOV
83
]
×
84

85
{ #category : 'document' }
86
MiModelReportModel >> classMembersStats: columns [
×
87

×
88
        self stats: columns compute: [ :c | c numberOfAttributes ] description: 'FIELDS'.
×
89
        self stats: columns compute: [ :c | c numberOfMethods ]    description: 'METHODS'
×
UNCOV
90
]
×
91

92
{ #category : 'settings management' }
93
MiModelReportModel >> currentConfiguration [
×
94

×
95
        ^ MiModelReportSettingsConfiguration new
×
96
                  largeClassThreshold: largeClassThreshold;
×
97
                  longClassThreshold: longClassThreshold;
×
98
                  dataClassThreshold: dataClassThreshold;
×
99
                  longMethodThreshold: longMethodThreshold;
×
100
                  complexMethodThreshold: complexMethodThreshold;
×
101
                  excessiveAPIThreshold: excessiveAPIThreshold;
×
102
                  yourself
×
UNCOV
103
]
×
104

105
{ #category : 'accessing' }
106
MiModelReportModel >> defaultConfiguration [
×
107

×
108
        ^ self class defaultConfiguration
×
UNCOV
109
]
×
110

111
{ #category : 'document' }
112
MiModelReportModel >> document [
×
113
                
×
114
        self title: ('Dashboard : '  , mooseModel name).
×
115

×
116
        self sectionPackages.
×
117
        self sectionClasses.
×
118
        self sectionMethods.
×
119

×
UNCOV
120
]
×
121

122
{ #category : 'accessing' }
123
MiModelReportModel >> entities [
×
124
        ^mooseModel
×
UNCOV
125
]
×
126

127
{ #category : 'api - export' }
128
MiModelReportModel >> exportReportToHTML: microdownText [
×
129

×
130
        | filename |
×
131
        filename := mooseModel name , '-report.html'.
×
132
        filename asFileReference writeStreamDo: [ :stream |
×
133
                stream nextPutAll: (MicHTMLVisitor asHTMLString: microdownText) ].
×
134
        browser inform:
×
135
                filename , ' generated' , String cr , '(in Pharo image directory)'
×
UNCOV
136
]
×
137

138
{ #category : 'api - export' }
139
MiModelReportModel >> exportReportToPDF: microdownText [
×
140

×
141
        browser inform: 'PDF export not implemented yet, sorry'
×
UNCOV
142
]
×
143

144
{ #category : 'private - formatting' }
145
MiModelReportModel >> floatAsString: aFloat [
×
146

×
147
        ^(aFloat asFloat round: 1) asString
×
148

×
UNCOV
149
]
×
150

151
{ #category : 'accessing' }
152
MiModelReportModel >> followEntity: aMooseEntity [
×
153

×
154
        mooseModel := (aMooseEntity isMooseModel ifTrue: [ aMooseEntity ] ifFalse: [ aMooseEntity mooseModel ]).
×
155
        self updateReport
×
UNCOV
156
]
×
157

158
{ #category : 'private - formatting' }
159
MiModelReportModel >> formatCollection: collection value: valueBlock [
×
160

×
161
        ^collection
×
162
                ifEmpty: [ 'n/a' ]
×
163
                ifNotEmpty: [ self floatAsString: (valueBlock value: collection) ]
×
UNCOV
164
]
×
165

166
{ #category : 'private - formatting' }
167
MiModelReportModel >> fullyQualifiedName: anEntity [
×
168

×
169
        ^anEntity mooseName copyReplaceAll: '::' with: '.' 
×
170

×
UNCOV
171
]
×
172

173
{ #category : 'testing' }
174
MiModelReportModel >> hasSettings [
×
175

×
176
        ^ true
×
UNCOV
177
]
×
178

179
{ #category : 'microdown' }
180
MiModelReportModel >> headerBlock: level header: aString [
×
181

×
182
        level timesRepeat: [ report << '#' ].
×
183
        report
×
184
                space ;
×
185
                << aString ;
×
186
                cr ; cr
×
UNCOV
187
]
×
188

189
{ #category : 'initialization' }
190
MiModelReportModel >> initializeSettings [
×
191

×
192
        largeClassThreshold := self class defaultLargeClassThreshold.
×
193
        longClassThreshold := self class defaultLongClassThreshold.
×
194
        dataClassThreshold := self class defaultDataClassThreshold.
×
195
        longMethodThreshold := self class defaultLongMethodThreshold.
×
196
        complexMethodThreshold := self class defaultComplexMethodThreshold.
×
197
        excessiveAPIThreshold := self class defaultExcessiveAPIThreshold
×
UNCOV
198
]
×
199

200
{ #category : 'microdown' }
201
MiModelReportModel >> line: aString [
×
202

×
203
        report
×
204
                << aString ;
×
205
                cr
×
206

×
UNCOV
207
]
×
208

209
{ #category : 'document' }
210
MiModelReportModel >> methodMembersStats: columns [
×
211

×
212
        self stats: columns compute: [ :m | m numberOfParameters ] description: 'PARAMETERS'.
×
213
        self stats: columns compute: [ :m | m numberOfLinesOfCode ]    description: 'LINES OF CODE'.
×
214
        self stats: columns compute: [ :m | m cyclomaticComplexity ]    description: 'CYCLOMATIC COMPLEXITY'
×
UNCOV
215
]
×
216

217
{ #category : 'accessing' }
218
MiModelReportModel >> miSelectedItem [
×
219

×
220
        ^#()
×
UNCOV
221
]
×
222

223
{ #category : 'private - formatting' }
224
MiModelReportModel >> numericValue: text value: number [
×
225

×
226
        ^text , ': ' , number asString
×
227
                
×
UNCOV
228
]
×
229

230
{ #category : 'accessing' }
231
MiModelReportModel >> reportDOM [
×
232

×
233
        ^ report
×
UNCOV
234
]
×
235

236
{ #category : 'api - export' }
237
MiModelReportModel >> saveRawReport: microdownText [
×
238

×
239
        | filename |
×
240
        filename := mooseModel name , '-report.md'.
×
241
        filename asFileReference writeStreamDo: [ :stream |
×
242
                stream nextPutAll: microdownText
×
243
        ].
×
244
        browser inform: filename , ' saved', String cr , '(in Pharo image directory)'
×
UNCOV
245
]
×
246

247
{ #category : 'document' }
248
MiModelReportModel >> sectionClasses [
×
249

×
250
        | allClasses largeClasses longClasses dataClasses |
×
251
        allClasses := OrderedCollection withAll: mooseModel allModelClasses.
×
252
        largeClasses := allClasses select: [ :c |
×
253
                                c numberOfMethods > largeClassThreshold ].
×
254
        longClasses := allClasses select: [ :c |
×
255
                               c numberOfLinesOfCode > longClassThreshold ].
×
256
        dataClasses := allClasses select: [ :c |
×
257
                               c numberOfAttributes > dataClassThreshold ].
×
258

×
259
        self subtitle: 'Classes'.
×
260

×
261
        "Stats table"
×
262
        self tableHeader: #( '' All Large Long Data ).
×
263
        self
×
264
                statLine: {
×
265
                                allClasses size asString.
×
266
                                largeClasses size asString.
×
267
                                longClasses size asString.
×
268
                                dataClasses size asString }
×
269
                description: 'number'.
×
270
        self classMembersStats: {
×
271
                        allClasses.
×
272
                        largeClasses.
×
273
                        longClasses.
×
274
                        dataClasses }.
×
275

×
276
        "Lists of entities"
×
277
        self
×
278
                subSectionSpecialList: largeClasses
×
279
                description:
×
280
                'Large classes (> ' , largeClassThreshold asString , ' methods)'.
×
281
        self
×
282
                subSectionSpecialList: longClasses
×
283
                description:
×
284
                'Long classes (> ' , longClassThreshold asString , ' LOC)'.
×
285
        self
×
286
                subSectionSpecialList: dataClasses
×
287
                description:
×
288
                'Data classes (> ' , dataClassThreshold asString , ' fields)'
×
UNCOV
289
]
×
290

291
{ #category : 'document' }
292
MiModelReportModel >> sectionMethods [
×
293

×
294
        | allMethods longMethods complexMethods excessiveAPIMethods |
×
295
        allMethods := OrderedCollection withAll: mooseModel allModelMethods.
×
296
        longMethods := allMethods select: [ :m |
×
297
                               m numberOfLinesOfCode > longMethodThreshold ].
×
298
        complexMethods := allMethods select: [ :m |
×
299
                                  m cyclomaticComplexity > complexMethodThreshold ].
×
300
        excessiveAPIMethods := allMethods select: [ :m |
×
301
                                       m numberOfParameters > excessiveAPIThreshold ].
×
302
        self subtitle: 'Methods'.
×
303

×
304
        "Stats table"
×
305
        self tableHeader: { ''. 'All'. 'Long'. 'Complex'. 'Excessive API' }.
×
306
        self
×
307
                statLine: {
×
308
                                allMethods size asString.
×
309
                                longMethods size asString.
×
310
                                complexMethods size asString.
×
311
                                excessiveAPIMethods size asString }
×
312
                description: 'number'.
×
313
        self methodMembersStats: {
×
314
                        allMethods.
×
315
                        longMethods.
×
316
                        complexMethods.
×
317
                        excessiveAPIMethods }.
×
318
        self line: ''.
×
319

×
320
        "Lists of entities"
×
321
        self
×
322
                subSectionSpecialList: longMethods
×
323
                description:
×
324
                'Long methods (> ' , longMethodThreshold asString , ' LOC)'.
×
325
        self
×
326
                subSectionSpecialList: complexMethods
×
327
                description: 'Complex methods (cyclomatic complexity > '
×
328
                        , complexMethodThreshold asString , ')'.
×
329
        self
×
330
                subSectionSpecialList: excessiveAPIMethods
×
331
                description:
×
332
                        'Excessive API methods (> ' , excessiveAPIThreshold asString
×
333
                        , ' parameters)'
×
UNCOV
334
]
×
335

336
{ #category : 'document' }
337
MiModelReportModel >> sectionMethodsStats: methods [
×
338

×
339
        self stats: (methods collect: [ :c | c numberOfParameters ]) description: 'parameters'.
×
340
        self stats: (methods collect: [ :c | c numberOfLinesOfCode ]) description: 'lines of code'.
×
341
        self stats: (methods collect: [ :c | c cyclomaticComplexity ]) description: 'cyclomatic complexity'
×
342

×
UNCOV
343
]
×
344

345
{ #category : 'document' }
346
MiModelReportModel >> sectionPackages [
×
347
        | number allClasses |
×
348

×
349
        self subtitle: 'Packages'.
×
350

×
351
        number := mooseModel allModelPackages size.
×
352
        allClasses := mooseModel allModelClasses asOrderedCollection.
×
353

×
354
        self line:
×
355
                (self numericValue: 'Number of Packages' value: number).
×
356
        self line:
×
357
                (self numericValue: 'Mean number of classes' value: (self floatAsString: (allClasses size / number))).
×
358
        self line:
×
359
                (self numericValue: 'Total number of classes' value: allClasses size).
×
360
        self line:
×
361
                (self numericValue: 'Total number of lines of code' value: (allClasses sum: #numberOfLinesOfCode)).
×
362
        self line: ''
×
363

×
UNCOV
364
]
×
365

366
{ #category : 'settings' }
367
MiModelReportModel >> settingsChanged: aBoolean [
×
368

×
369
        aBoolean ifTrue: [ self updateReport ].
×
UNCOV
370
]
×
371

372
{ #category : 'settings management' }
373
MiModelReportModel >> settingsPresenterExtent [
×
374

×
375
        ^ 425 @ 350
×
UNCOV
376
]
×
377

378
{ #category : 'microdown' }
379
MiModelReportModel >> statLine: columns        description: aString [
×
380

×
381
        self tableLine: { aString } , columns
×
UNCOV
382
]
×
383

384
{ #category : 'microdown' }
385
MiModelReportModel >> stats: columns compute: valueBlock description: aString [
×
386
        "columns is a collection of collections of entities (eg. {allClasses, largeClasses, longClasses})
×
387
         valueBlock takes one entity of these collections and compute a number form it (eg. numberOfAttributes)
×
388
         From this, we display 3 lines: mean value, median value, max value for each column"
×
389

×
390
        | valuesCollection |
×
391
        valuesCollection := columns collect: [ :collection | collection collect: valueBlock ].
×
392

×
393
        self tableLine: { aString }.
×
394
        self
×
395
                statLine: (valuesCollection collect: [ :column | self formatCollection: column value: #average])
×
396
                description: '. mean'.
×
397
        self
×
398
                statLine: (valuesCollection collect: [ :column | self formatCollection: column value: #median])
×
399
                description: '. median'.
×
400
        self
×
401
                statLine: (valuesCollection collect: [ :column | self formatCollection: column value: #max])
×
402
                description: '. max'
×
403

×
UNCOV
404
]
×
405

406
{ #category : 'document' }
407
MiModelReportModel >> subSectionSpecialList: collection description: aString [
×
408

×
409
        self subsubtitle: aString.
×
410

×
411
        self line: (self numericValue: 'Number' value: collection size).
×
412

×
413
        self bulletList: ((collection collect: [:c | self fullyQualifiedName: c ])
×
414
                sorted: [:a :b | a mooseName < b mooseName]).
×
415

×
UNCOV
416
]
×
417

418
{ #category : 'document' }
419
MiModelReportModel >> subSectionSpecialMethods: selectionBlock description: aString [
×
420

×
421
        | methods |
×
422
        self subsubtitle: aString.
×
423

×
424
        methods := (mooseModel allModelMethods select: selectionBlock)
×
425
                sorted: [:a :b | a mooseName < b mooseName].
×
426

×
427
        self line: (self numericValue: 'Number' value: methods size).
×
428
        self bulletList: (methods collect: [:c | self fullyQualifiedName: c ] ).
×
429

×
430
        self sectionMethodsStats: methods 
×
431

×
UNCOV
432
]
×
433

434
{ #category : 'microdown' }
435
MiModelReportModel >> subsubtitle: aString [
×
436

×
437
        ^self headerBlock: 3 header: aString.
×
438

×
UNCOV
439
]
×
440

441
{ #category : 'microdown' }
442
MiModelReportModel >> subtitle: aString [
×
443

×
444
        ^self headerBlock: 2 header: aString.
×
445

×
UNCOV
446
]
×
447

448
{ #category : 'microdown' }
449
MiModelReportModel >> tableHeader: aCollection [
×
450

×
451
        self tableLine: aCollection.
×
452
        report
×
453
                << '|---|' ;
×
454
                cr
×
UNCOV
455
]
×
456

457
{ #category : 'microdown' }
458
MiModelReportModel >> tableLine: aCollection [
×
459

×
460
        aCollection do: [ :item |
×
461
                report
×
462
                        << '| ' ;
×
463
                        << item ;
×
464
                        space
×
465
        ].
×
466
        report
×
467
                << '|' ;
×
468
                cr
×
UNCOV
469
]
×
470

471
{ #category : 'microdown' }
472
MiModelReportModel >> title: aString [
×
473

×
474
        ^self headerBlock: 1 header: aString.
×
475

×
UNCOV
476
]
×
477

478
{ #category : 'settings management' }
479
MiModelReportModel >> updateFromConfiguration: aConfiguration [
×
480

×
481
        largeClassThreshold := aConfiguration largeClassThreshold.
×
482
        longClassThreshold := aConfiguration longClassThreshold.
×
483
        dataClassThreshold := aConfiguration dataClassThreshold.
×
484

×
485
        longMethodThreshold := aConfiguration longMethodThreshold.
×
486
        complexMethodThreshold := aConfiguration complexMethodThreshold.
×
487
        excessiveAPIThreshold := aConfiguration excessiveAPIThreshold.
×
488

×
489
        mooseModel ifNil: [ ^ self ].
×
490
        self updateReport
×
UNCOV
491
]
×
492

493
{ #category : 'running' }
494
MiModelReportModel >> updateReport [
×
495

×
496
        report := String new writeStream .
×
497
        self document.
×
498
        report close.
×
499
        browser generatedReport: report contents
×
UNCOV
500
]
×
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