CQM-GodClassRoutine¶
Classes shall not have too many routines
Required inputs: RFG
Any class that contains more than 50 routines is a violation of this rule.
Motivation
A god class has a very wide interface due to the many routines with a high visibility compared to the class itself. This width means that both their use and maintenance are excessively costly. Often such classes have very little cohesion, i.e. the class is more an over-sized container of different abstractions and functionality than a unified concept with data and routines accessing it.
This rule is based on the CQM Quality Indicator: Gottklasse (Methode) (p. 198-200).
Reference
Simon, Frank/ Seng, Olaf/ Mohaupt, Thomas (2006): Code-Quality-Management: Technische Qualität industrieller Softwaresysteme transparent und vergleichbar gemacht, 1st ed., Heidelberg, Germany: dpunkt.verlag GmbH.
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
to_many_routines |
This class contains {val} routines, it should contain no more than {max_number_of_routines} routines. |
None |
False |
Options¶
This rule shares the following common options: exclude_messages_in_system_headers, excludes, includes, justification_checker, post_processing, provider, severity
This rule shares the following common metric options: base_view_name
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
count_constructors¶
count_constructors : bool = False
count_deleted¶
count_deleted : bool = True
count_destructors¶
count_destructors : bool = False
count_operators¶
count_operators : bool = True
count_private¶
count_private : bool = True
count_protected¶
count_protected : bool = True
count_public¶
count_public : bool = True
count_template_routines¶
count_template_routines : bool = False
include_structs¶
include_structs : bool = False
include_template_classes¶
include_template_classes : bool = False
max_number_of_routines¶
max_number_of_routines : int = 50