CQM-SloppyCommenting¶
Ratio between all lines of code and lines containing comments
Required inputs: RFG
Determines the ratio between the total lines of code (BLOC)
and comment lines (CLOC) according to the formula
(abs(BLOC - 2 * CLOC) / BLOC) * 1000.
This is a violation, if the ratio is less than 1.45
or greater than 370.26.
Motivation
This problem pattern addresses the system-wide level of commenting as a necessary criteria of the documentation supporting the maintenance process. If this value is significantly higher than what is stored in the QBL repository, then there are considerably fewer comments than is usual system-wide. Regardless of the content of the few comments, it can therefore be assumed that the documentation is insufficient and that any work on the code means significant additional work and may be prone to errors.
This rule is based on the CQM Quality Indicator: nachlässige Kommentierung (p. 246-248).
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
This rule has no predefined messages.
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, excluded_node_types, hierarchy_edge_name, hierarchy_view_name, propagate, report_all_values, report_propagated_values
The following places define options that affect this rule: Analysis-GlobalOptions
display_name¶
display_name : str | None = 'Ratio between all lines of code and lines containing comments'
max_value¶
max_value : float | None = 370.26
min_value¶
min_value : float | None = 1.45
rfg_metric_name¶
rfg_metric_name : str = 'Metric.SloppyCommenting'