CQM-Classlet¶
Classes shall not have too few data members and/or routines
Required inputs: RFG
Any class that contains less than 3 data members or less than 3 routines is a violation of this rule.
Motivation
In the case of very small classes, the question arises whether this class is really useful or if it should not better be merged with another class. Often, classlets are created by moving functionality to other classes, but the class itself is not dissolved accordingly. A class that is too small represents an unnecessary abstraction that is more of a hindrance to understanding the system. Understanding becomes more difficult the more classlets are in the system.
This rule is based on the CQM Quality Indicator: Klässchen (p. 228-230).
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_few_members_and |
This class contains {routines} routines and {members} data members, it should at least contain {min_number_of_routines} routines and {min_number_of_members} data members. |
None |
False |
to_few_members_or |
This class contains {routines} routines and {members} data members, it should at least contain {min_number_of_routines} routines or {min_number_of_members} data members. |
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_routines_and_attributes_separate¶
count_routines_and_attributes_separate : bool = False
If
False, a class is a violation if it has less than 3
routines and less than 3 data members. If True,
the class is considered a violation if it has less than 3 routines
or less than 3 data members. So a class that contains 2 routines and 4 data members is considered a violation if this option is
True,
but not if it is False.
count_template_routines¶
count_template_routines : bool = False
include_abstract_classes¶
include_abstract_classes : bool = True
include_classes_without_definition¶
include_classes_without_definition : bool = False
include_structs¶
include_structs : bool = False
include_template_classes¶
include_template_classes : bool = False
min_number_of_members¶
min_number_of_members : int = 3
min_number_of_routines¶
min_number_of_routines : int = 3