Groovy Documentation

org.codenarc.rule
[Groovy] Class AbstractAstVisitorRule

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

abstract class AbstractAstVisitorRule
extends AbstractRule

Abstract superclass for Rules that use a Groovy AST Visitor.

Each subclass must set the astVisitorClass property or else define a new property with the same name, specifying the Class of the AstVisitor to applied to the specified source code.

Authors:
Chris Mair
Version:
\$Revision: 609 \$ - \$Date: 2011-02-24 13:48:43 -0500 (Thu, 24 Feb 2011) \$


Field Summary
protected static def DEFAULT_CONST_NAME

protected static def DEFAULT_FIELD_NAME

protected static def DEFAULT_TEST_CLASS_NAMES

protected static def DEFAULT_TEST_FILES

protected static def DEFAULT_VAR_NAME

 
Property Summary
String applyToClassNames

This rule is only applied to classes with names matching this value.

Class astVisitorClass

Each concrete subclass must either set this property or define its own property with the same name

String doNotApplyToClassNames

This rule is NOT applied to classes with names matching this value.

 
Method Summary
void applyTo(SourceCode sourceCode, List violations)

AstVisitor getAstVisitor()

protected boolean shouldApplyThisRuleTo(def classNode)

Return true if this rule should be applied for the specified ClassNode, based on the configuration of this rule.

 
Methods inherited from class AbstractRule
applyTo, applyTo, createViolation, createViolation, createViolationForImport, createViolationForImport, getImportsSortedByLineNumber, getName, getPriority, isReady, packageNameForImport, setName, setPriority, sourceLineAndNumberForImport, sourceLineAndNumberForImport, toString, validate
 

Field Detail

DEFAULT_CONST_NAME

protected static final def DEFAULT_CONST_NAME


DEFAULT_FIELD_NAME

protected static final def DEFAULT_FIELD_NAME


DEFAULT_TEST_CLASS_NAMES

protected static final def DEFAULT_TEST_CLASS_NAMES


DEFAULT_TEST_FILES

protected static final def DEFAULT_TEST_FILES


DEFAULT_VAR_NAME

protected static final def DEFAULT_VAR_NAME


 
Property Detail

applyToClassNames

String applyToClassNames
This rule is only applied to classes with names matching this value. The value may optionally be a comma-separated list of names, in which case one of the names must match. If a name includes a period ('.'), then it is assumed to specify a full package name, so the name (pattern) is matched against each fully-qualified class name. Otherwise it is matched only against the class name without a package. The name(s) may optionally include wildcard characters ('*' or '?').


astVisitorClass

Class astVisitorClass
Each concrete subclass must either set this property or define its own property with the same name


doNotApplyToClassNames

String doNotApplyToClassNames
This rule is NOT applied to classes with names matching this value. The value may optionally be a comma-separated list of names, in which case any one of the names can match. If a name includes a period ('.'), then it is assumed to specify a full package name, so the name (pattern) is matched against each fully-qualified class name. Otherwise it is matched only against the class name without a package. The name(s) may optionally include wildcard characters ('*' or '?').


 
Method Detail

applyTo

void applyTo(SourceCode sourceCode, List violations)


getAstVisitor

AstVisitor getAstVisitor()


shouldApplyThisRuleTo

protected boolean shouldApplyThisRuleTo(def classNode)
Return true if this rule should be applied for the specified ClassNode, based on the configuration of this rule.
Parameters:
classNode - - the ClassNode
Returns:
true if this rule should be applied for the specified ClassNode


 

Groovy Documentation