From a5ea29b3c08c34acf88533624aa7e4872c5da3c0 Mon Sep 17 00:00:00 2001 From: anquetil Date: Fri, 3 Jan 2025 14:50:36 +0100 Subject: [PATCH] Added a section to class statistics (data classes) --- .../MiModelReportModel.class.st | 51 +++++++++++++++---- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/src/MooseIDE-Core-Reporter/MiModelReportModel.class.st b/src/MooseIDE-Core-Reporter/MiModelReportModel.class.st index ab4837b1..f5885ed3 100644 --- a/src/MooseIDE-Core-Reporter/MiModelReportModel.class.st +++ b/src/MooseIDE-Core-Reporter/MiModelReportModel.class.st @@ -29,7 +29,7 @@ MiModelReportModel >> bulletList: aCollection [ { #category : #document } MiModelReportModel >> classMembersStats: columns [ - self stats: columns compute: [ :c | c numberOfAttributes ] description: 'ATTRIBUTES'. + self stats: columns compute: [ :c | c numberOfAttributes ] description: 'FIELDS'. self stats: columns compute: [ :c | c numberOfMethods ] description: 'METHODS' ] @@ -39,6 +39,12 @@ MiModelReportModel >> complexMethodLimit [ ^ settings getItemValue: #complexMethodSetting ] +{ #category : #settings } +MiModelReportModel >> dataClassLimit [ + + ^ settings getItemValue: #dataClassSetting +] + { #category : #document } MiModelReportModel >> document [ @@ -117,10 +123,9 @@ MiModelReportModel >> headerBlock: level header: aString [ cr ; cr ] -{ #category : #initialization } -MiModelReportModel >> initializeSettings [ +{ #category : #settings } +MiModelReportModel >> initializeClassSettings [ - settings := super initializeSettings. settings addItem: (MiTextSettingItem integerSetting setValue: 100 ; @@ -136,6 +141,18 @@ MiModelReportModel >> initializeSettings [ yourself) named: #longClassSetting ; + addItem: (MiTextSettingItem integerSetting + setValue: 10 ; + label: 'Data class' ; + help: 'Above this number of attribute, a class is considered to be a Data class' ; + yourself) + named: #dataClassSetting +] + +{ #category : #settings } +MiModelReportModel >> initializeMethodSettings [ + + settings addItem: (MiTextSettingItem integerSetting setValue: 100 ; label: 'Long method' ; @@ -157,6 +174,16 @@ MiModelReportModel >> initializeSettings [ yourself) named: #excessiveAPIMethodLimit. + +] + +{ #category : #settings } +MiModelReportModel >> initializeSettings [ + + settings := super initializeSettings. + self initializeClassSettings. + self initializeMethodSettings. + ] { #category : #settings } @@ -227,19 +254,19 @@ MiModelReportModel >> saveRawReport: microdownText [ { #category : #document } MiModelReportModel >> sectionClasses [ - | allClasses largeClasses longClasses | + | allClasses largeClasses longClasses dataClasses | allClasses := OrderedCollection withAll: mooseModel allModelClasses. largeClasses := allClasses select: [ :c | c numberOfMethods > self largeClassLimit ]. longClasses := allClasses select: [ :c | c numberOfLinesOfCode > self longClassLimit ]. + dataClasses := allClasses select: [ :c | c numberOfAttributes > self dataClassLimit ]. self subtitle: 'Classes'. "Stats table" - self tableHeader: { '' . 'All' . 'Large' . 'Long' }. - self statLine: { allClasses size asString . largeClasses size asString . longClasses size asString } description: 'number'. - self classMembersStats: { allClasses . largeClasses . longClasses }. - self line: ''. + self tableHeader: #( '' All Large Long Data ). + self statLine: { allClasses size asString . largeClasses size asString . longClasses size asString . dataClasses size asString } description: 'number'. + self classMembersStats: { allClasses . largeClasses . longClasses . dataClasses }. "Lists of entities" self @@ -247,7 +274,11 @@ MiModelReportModel >> sectionClasses [ description: 'Large classes (> ' , self largeClassLimit asString , ' methods)'. self subSectionSpecialList: longClasses - description: 'Long classes (> ' , self longClassLimit asString , ' LOC)' + description: 'Long classes (> ' , self longClassLimit asString , ' LOC)'. + self + subSectionSpecialList: dataClasses + description: 'Data classes (> ' , self dataClassLimit asString , ' fields)'. + ] { #category : #document }