Groovy Documentation

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

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

class AbcComplexityRule
extends AbstractAstVisitorRule

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

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

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

The maxClassComplexity property holds the threshold value for the total ABC complexity value for each class. If this value is non-zero, a class with a total ABC complexity value greater than this value is considered a violation. The value does not have to be an integer (i.e., 1.7 is allowed). The maxClassComplexity 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.

deprecated:
This rule is deprecated and disabled (enabled=false) by default. Use AbcMetric rule instead.
See Also:
Authors:
Chris Mair


Property Summary
Class astVisitorClass

String ignoreMethodNames

int maxClassAverageMethodComplexity

int maxClassComplexity

int maxMethodComplexity

String name

int priority

 
Constructor Summary
AbcComplexityRule()

 

Property Detail

astVisitorClass

Class astVisitorClass


ignoreMethodNames

String ignoreMethodNames


maxClassAverageMethodComplexity

int maxClassAverageMethodComplexity


maxClassComplexity

int maxClassComplexity


maxMethodComplexity

int maxMethodComplexity


name

String name


priority

int priority


 
Constructor Detail

AbcComplexityRule

AbcComplexityRule()


 

Groovy Documentation