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

count_private

count_private : bool = True

Count private members of class.
 

count_protected

count_protected : bool = True

Count protected members of class.
 

count_public

count_public : bool = True

Count public members of class.
 

include_structs

include_structs : bool = False

Whether structs are to be analyzed.
 

include_template_classes

include_template_classes : bool = False

Whether template classes are to be analyzed.
 

max_number_of_members

max_number_of_members : int = 50

Maximum allowed number of data members in a class.