Groovy Documentation

org.codenarc.rule
Class AbstractAstVisitorRule

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

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.

author:
Chris Mair
version:
$Revision: 203 $ - $Date: 2009-08-14 21:48:54 -0400 (Fri, 14 Aug 2009) $


Property 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

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.

 
Constructor Summary
AbstractAstVisitorRule()

 
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, createViolation, createViolation, createViolationForImport, createViolationForImport, getImportsSortedByLineNumber, getName, getPriority, packageNameForImport, setName, setPriority, sourceLineAndNumberForImport, sourceLineAndNumberForImport
 

Property 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


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 '?').


 
Constructor Detail

AbstractAstVisitorRule

AbstractAstVisitorRule()


 
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.
param:
classNode - the ClassNode
return:
true if this rule should be applied for the specified ClassNode


 

Groovy Documentation