CQM-IncompleteInheritanceRoutine¶
Multiple subclasses contain the same routine, which does not exist in their superclass
Required inputs: IR
Multiple routines with the same signature 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 of subclasses into a common superclass. Despite the multiple use in the subclasses, the behavior then only needs to be understood, tested and maintained once. Since inheritance structures are subject however to strong changes, it comes in particular with older inheritance structures that such factorization potentials remain unused. 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 (Methode) (p. 309-311).
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_routine |
This routine exists in a large number of subclasses, but not the superclass. |
None |
False |
Options¶
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
max_number_occurrences¶
max_number_occurrences : int = 10
max_percentage_occurrences. If routines
with the same signature are found in more than
max_percentage_occurrences percent of subclasses max_number_occurrences of routines with the same
signature, it is a violation.
max_percentage_occurrences¶
max_percentage_occurrences : float = 50.0
max_number_occurrences. If routines with the same signature are
found in more than max_percentage_occurrences percent of subclasses
max_number_occurrences of
routines with the same signature, it is a violation.