CQM-SecretRelation

Classes should not have public routines that are not called from outside their inheritance hierarchy

Required inputs: IR

A public routine from a super class only is used by the class itself or any of its (in)direct sub classes. Does not include routines that are never called.

Motivation

Non-polymorphic inheritance means that clients use the interfaces of the subclasses directly and not those of the superclasses in which this interface is publicly declared. This is an indication that the inheritance relationship was created for the purpose of source code reuse or signature reuse, but this was not taken into account accordingly in the superclass or interface (e.g. through appropriate visibility reductions). Inheritance that is not used polymorphic can also result from clients merely addressing the wrong abstraction (interface bypass). If an interface is used exclusively by interface bypasses (i.e., consistently bypassed), the problem of secret relation also exists there.

This rule is based on the CQM Quality Indicator: heimliche Verwandschaft (p. 210-213).

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

secret_relation

This class contains public routines that are only used inside its inheritance hierarchy.

None

False

Options

include_virtual_routines

include_virtual_routines : bool = True

Whether virtual routines should be considered.