CQM-MaskingFile

Files should contain classes with a similar name

Required inputs: RFG

At least one not nested class in each file should have a name that contains the file name.

Motivation

In the programming languages under consideration, code is always stored in files. While in Java between contents and the surrounding file a naming 1:1 mapping is enforced with public classes, this does not apply to C++ and in Java for package-private classes. The possibility given in principle to cover any connection between contained class and file name with the designation, makes locating classes clearly more difficult. The name of a file should appear therefore in each case in the name of at least one contained class. Possible name extensions in the form of prefixes ( e.g. C) or postfixes (e.g. Impl) do not complicate the finding of a class.

This rule is based on the CQM Quality Indicator: maskierende Datei (p. 243-245).

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

masking_file

This file does not contain a class that shares its name.

None

False

Options

include_abstract_classes

include_abstract_classes : bool = True

Whether abstract classes should be included.
 

include_structs

include_structs : bool = True

Whether structs should be included.
 

include_template_classes

include_template_classes : bool = True

Whether template classes should be included.
 

report_files_without_classes

report_files_without_classes : bool = False

Whether files that do not contain any classes should be reported.