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¶
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
include_virtual_routines¶
include_virtual_routines : bool = True