CQM-GodClassMember¶
Classes shall not have too many data members
Required inputs: RFG
Any class that contains more than 50 data members is a violation of this rule.
Motivation
A class that consists of too many data members can only with difficulty ensure the consistent state of the data members. Understanding and maintaining such god classes also involves a significantly excessive amount of effort. The recognition of cohesive data member subsets is complicated by the lack of clustering into multiple subclasses.
This rule is based on the CQM Quality Indicator: Gottklasse (Attribut) (p. 195-197).
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_members |
This class contains {val} data members, it should contain no more than {max_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_private¶
count_private : bool = True
count_protected¶
count_protected : bool = True
count_public¶
count_public : bool = True
include_structs¶
include_structs : bool = False
include_template_classes¶
include_template_classes : bool = False
max_number_of_members¶
max_number_of_members : int = 50