CQM-IncompleteInheritanceField¶
Multiple subclasses contain the same field, which does not exist in their superclass
Required inputs: RFG
Multiple fields with the same name exists in at least 10 or more than 50.0 percent of direct subclasses but not in the superclass. Only for superclasses with at least 2 subclasses.
Motivation
A powerful way of inheritance is to factor out common behavior and common state sets of subclasses in a common superclass. Despite multiple uses in the subclasses, the inherited behavior and state then only needs to be understood, tested, and maintained once. Since inheritance structures are subject to strong changes, it is often the case that such factorization potentials remain unused: particular in connection with older inheritance structures. The result is redundant implementations with multiple efforts for testing, maintenance and understanding.
This rule is based on the CQM Quality Indicator: unvollständige Vererbung (Attribut) (p. 306-308).
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 |
|---|---|---|---|
incomplete_inheritance_field |
This field exists in a large number of the subclasses but not the superclass. |
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
max_number_occurrences¶
max_number_occurrences : int = 10
max_percentage_occurrences. If fields with the
same name are found in more than max_percentage_occurrences percent of
subclasses max_number_occurrences of fields with the same name, it is a violation.
max_percentage_occurrences¶
max_percentage_occurrences : float = 50.0
max_number_occurrences. If fields with the
same name are found in more than max_percentage_occurrences percent of
subclasses max_number_occurrences of fields with the same name, it is a violation.