CQM-RejectedInheritanceImplementation¶
A routine of a superclass gets overridden or hidden in most of the subclasses
Required inputs: IR
A routine of a superclass gets overridden or is hidden non-empty in most of its direct subclasses without it being used. This is a sign that the implementation in the superclass is not general enough and should be avoided. This does not include pure virtual routines.
Motivation
In general, subclasses are allowed to override inherited methods belonging to the interface of the superclass with specialized versions. However, if this happens in the majority of subclasses, it is a sign that the inherited implementation is not general enough. This is especially true if the reimplementations manage without using the inherited method (i.e. do not call it), since no connection in content between the two methods is apparent here. In these cases, the chosen inheritance structure is obviously not optimal.
This rule is based on the CQM Quality Indicator: ausgeschlagenes Erbe (Implementierung) (p. 173-175).
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 |
|---|---|---|---|
rejected_inheritance_implementation |
This routine is hidden in {per} of all subclasses. |
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