CQM-IdentitySplit

Classes should have unique names

Required inputs: RFG

There must not be more than one class with the same name in the system regardless of case sensitivity.

Motivation

Classes and interfaces are not referenced in code by their fully qualified name (e.g. java.util.HashMap) in most cases, but only by their name (e.g. HashMap). If there are now several classes/interfaces with the same name in the system, a high danger of confusion exists, since the actually used class/interface is not immediately obvious. Instead the used class must be determined by the analysis of the context (the imported classes/packages). Even the use of modern IDEs does not eliminate the problem completely. These can determine the fully qualified name automatically, but often show it only in the form of tooltips. When simply reading the code this information is missing.

This rule is based on the CQM Quality Indicator: Identitätsspaltung (p. 213-215).

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

identity_split

These classes share the same name.

None

False

Options

include_structs

include_structs : bool = True

Whether structs are to be analyzed.
 

include_template_classes

include_template_classes : bool = True

Whether template classes are to be analyzed.