Groovy Documentation

org.codenarc.rule.size
[Groovy] Class NestedBlockDepthRule

java.lang.Object
  org.codenarc.rule.AbstractRule
      org.codenarc.rule.AbstractAstVisitorRule
          org.codenarc.rule.size.NestedBlockDepthRule

class NestedBlockDepthRule
extends AbstractAstVisitorRule

Rule that checks for blocks or closures nested more than a configured maximum number. Blocks include if, for, while, switch, try, catch, finally and synchronized blocks/statements, as well as closures.

The maxNestedBlockDepth property holds the threshold value for the maximum number of nesting levels. A block or closures nested deeper than that numer of levels is considered a violation. The maxNestedBlockDepth property defaults to 3.

Authors:
Chris Mair
Hamlet D'Arcy
Version:
\$Revision: 445 \$ - \$Date: 2010-11-09 16:06:17 -0500 (Tue, 09 Nov 2010) \$


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

int maxNestedBlockDepth

String name

int priority

 
Method Summary
 
Methods inherited from class AbstractAstVisitorRule
applyTo, getAstVisitor, shouldApplyThisRuleTo
 
Methods inherited from class AbstractRule
applyTo, applyTo, createViolation, createViolation, createViolationForImport, createViolationForImport, getImportsSortedByLineNumber, getName, getPriority, isReady, packageNameForImport, setName, setPriority, sourceLineAndNumberForImport, sourceLineAndNumberForImport, toString, validate
 

Property Detail

astVisitorClass

Class astVisitorClass


maxNestedBlockDepth

int maxNestedBlockDepth


name

String name


priority

int priority


 

Groovy Documentation