CQM-ForbiddenLoveClass¶
The number of cycles at class level
Required inputs: RFG
This metric counts the number of cycles at class level.
Motivation
Using a clever »divide et impera« strategy helps creating modular units like classes and interfaces, where each of these units can be understood, tested and maintained separately. If no such strategy is applied, Forbidden class love can emerge: I.e., two units have dependencies that make them dependent from each other (e.g. type accesses, method invocations, use of attributes or constants). In this case, in order to compile one unit, the other unit is required and vice versa, and in consequence, in order to modify on one unit, the other unit always has to be considered and adapted as well.
Note: The original definition of this rule focuses on direct cyclic dependencies between class/interface pairs, our implementation however also considers indirect dependencies and cycles consisting of more than 2 classes/interfaces.
This rule is based on the CQM Quality Indicator: verbotene Klassenliebe (p. 315-317).
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 = 'The number of cycles at class level'
max_value¶
max_value : int | None = 9
min_value¶
min_value : int | None = 0
rfg_metric_name¶
rfg_metric_name : str = 'Metric.ForbiddenLove.Class'