Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a section to class statistics (data classes) #1297

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 41 additions & 10 deletions src/MooseIDE-Core-Reporter/MiModelReportModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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'
]

Expand All @@ -39,6 +39,12 @@ MiModelReportModel >> complexMethodLimit [
^ settings getItemValue: #complexMethodSetting
]

{ #category : #settings }
MiModelReportModel >> dataClassLimit [

^ settings getItemValue: #dataClassSetting
]

{ #category : #document }
MiModelReportModel >> document [

Expand Down Expand Up @@ -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 ;
Expand All @@ -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' ;
Expand All @@ -157,6 +174,16 @@ MiModelReportModel >> initializeSettings [
yourself)
named: #excessiveAPIMethodLimit.


]

{ #category : #settings }
MiModelReportModel >> initializeSettings [

settings := super initializeSettings.
self initializeClassSettings.
self initializeMethodSettings.

]

{ #category : #settings }
Expand Down Expand Up @@ -227,27 +254,31 @@ 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
subSectionSpecialList: largeClasses
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 }
Expand Down
Loading