CQM-OverbookedFile¶
Files should not contain to many classes
Required inputs: RFG
Any file that contains more than 1 classes is a violation of this rule. This does not include nested classes.
Motivation
In the programming languages under consideration, code is always stored in files. The in principle given possibility of storing several classes within a file makes locating classes as well as the selective use of individual classes from such overbooked files more difficult. Ideally each file only contains one public and/or package-visible class.
This rule is based on the CQM Quality Indicator: Überbuchte Datei (p. 300-302).
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 |
|---|---|---|---|
to_many_classes |
A maximum of {max_number_of_classes} classes should be defined in one file. {number_of_classes_in_file} are defined in this File. |
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
count_template_specializations¶
count_template_specializations : bool = False
include_abstract_classes¶
include_abstract_classes : bool = True
include_structs¶
include_structs : bool = False
include_template_classes¶
include_template_classes : bool = True
max_number_of_classes¶
max_number_of_classes : int = 1
only_count_definitions¶
only_count_definitions : bool = True