|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD |
java.lang.Objectorg.codenarc.rule.AbstractRule
org.codenarc.rule.AbstractAstVisitorRule
org.codenarc.rule.size.CyclomaticComplexityRule
class CyclomaticComplexityRule extends AbstractAstVisitorRule
Rule that calculates the Cyclomatic Complexity for methods/classes and checks against configured threshold values.
ThemaxMethodComplexity
property holds the threshold value for the cyclomatic complexity
value 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 maxMethodComplexity
property defaults to 20.
The maxClassAverageMethodComplexity
property holds the threshold value for the average cyclomatic
complexity value for each class. If this value is non-zero, a class with an average cyclomatic complexity
value greater than this value is considered a violation. The maxMethodComplexity
property
defaults to 20.
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.
Field Summary |
---|
Fields inherited from class AbstractAstVisitorRule | |
---|---|
DEFAULT_CONST_NAME, DEFAULT_FIELD_NAME, DEFAULT_TEST_CLASS_NAMES, DEFAULT_TEST_FILES, DEFAULT_VAR_NAME |
Property Summary | |
---|---|
Class |
astVisitorClass
|
String |
ignoreMethodNames
|
int |
maxClassAverageMethodComplexity
|
int |
maxMethodComplexity
|
String |
name
|
int |
priority
|
Method Summary |
---|
Methods inherited from class AbstractAstVisitorRule | |
---|---|
applyTo, getAstVisitor, shouldApplyThisRuleTo |
Property Detail |
---|
Class astVisitorClass
String ignoreMethodNames
int maxClassAverageMethodComplexity
int maxMethodComplexity
String name
int priority
Groovy Documentation