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

display_name

display_name : str | None = 'The number of cycles at class level'

Description of the metric shown in the dashboard. If None, rfg_metric_name is used.
 

max_value

max_value : int | None = 9

Maximum allowed value. None if unlimited.
 

min_value

min_value : int | None = 0

Minimum allowed value. None if unlimited.
 

rfg_metric_name

rfg_metric_name : str = 'Metric.ForbiddenLove.Class'

Name of the node attribute storing the metric value in the RFG.