Groovy Documentation

groovy.org.codenarc.rule.size
[Groovy] Class AbcMetricRule

java.lang.Object
  org.codenarc.rule.AbstractAstVisitorRule
      groovy.org.codenarc.rule.size.AbcMetricRule

class AbcMetricRule
extends AbstractAstVisitorRule

Rule that calculates the ABC metric score for methods/classes and checks against configured threshold values.

The maxMethodAbcScore property holds the threshold value for the ABC score (magnitude) for each method. If this value is non-zero, a method with an ABC score greater than this value is considered a violation. The value does not have to be an integer (i.e., 1.7 is allowed). The maxMethodAbcScore property defaults to 60.

The maxClassAverageMethodAbcScore property holds the threshold value for the average ABC score for each class. If this value is non-zero, a class with an average ABC score greater than this value is considered a violation. The value does not have to be an integer (i.e., 1.7 is allowed). The maxClassAverageMethodAbcScore property defaults to 60.

The maxClassAbcScore property holds the threshold value for the total ABC score value for each class. If this value is non-zero, a class with a total ABC score greater than this value is considered a violation. The value does not have to be an integer (i.e., 1.7 is allowed). The maxClassAbcScore property defaults to 0.

The ignoreMethodNames property optionally specifies one or more (comma-separated) method names that should be ignored (i.e., that should not cause a rule violation). The name(s) may optionally include wildcard characters ('*' or '?'). Note that the ignored methods still contribute to the class complexity value.

This rule treats "closure fields" as methods. If a class field is initialized to a Closure (ClosureExpression), then that Closure is analyzed and checked just like a method.

See Also:
Authors:
Chris Mair


Property Summary
Class astVisitorClass

String ignoreMethodNames

int maxClassAbcScore

int maxClassAverageMethodAbcScore

int maxMethodAbcScore

String name

int priority

 

Property Detail

astVisitorClass

Class astVisitorClass


ignoreMethodNames

String ignoreMethodNames


maxClassAbcScore

int maxClassAbcScore


maxClassAverageMethodAbcScore

int maxClassAverageMethodAbcScore


maxMethodAbcScore

int maxMethodAbcScore


name

String name


priority

int priority


 

Groovy Documentation