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¶
This rule shares the following common options: exclude_messages_in_system_headers, excludes, includes, justification_checker, post_processing, provider, severity
This rule shares the following common metric options: base_view_name
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
include_abstract_classes¶
include_abstract_classes : bool = True
include_structs¶
include_structs : bool = True
include_template_classes¶
include_template_classes : bool = True
report_files_without_classes¶
report_files_without_classes : bool = False