org.codenarc.rule
Class AbstractAstVisitorRule

java.lang.Object
  extended by org.codenarc.rule.AbstractRule
      extended by org.codenarc.rule.AbstractAstVisitorRule
All Implemented Interfaces:
groovy.lang.GroovyObject, Rule
Direct Known Subclasses:
AbcComplexityRule, AbstractClassNameRule, AbstractClassWithoutAbstractMethodRule, AddEmptyStringRule, AssignmentInConditionalRule, BigDecimalInstantiationRule, BooleanGetBooleanRule, BooleanMethodReturnsNullRule, BrokenOddnessCheckRule, BusyWaitRule, CatchArrayIndexOutOfBoundsExceptionRule, CatchErrorRule, CatchExceptionRule, CatchIllegalMonitorStateExceptionRule, CatchIndexOutOfBoundsExceptionRule, CatchNullPointerExceptionRule, CatchRuntimeExceptionRule, CatchThrowableRule, ChainedTestRule, ClassNameRule, ClassSizeRule, CloneableWithoutCloneRule, CloseWithoutCloseableRule, CompareToWithoutComparableRule, ConfusingClassNamedExceptionRule, ConfusingMethodNameRule, ConfusingTernaryRule, ConsecutiveLiteralAppendsRule, ConsecutiveStringConcatenationRule, ConstantIfExpressionRule, ConstantsOnlyInterfaceRule, ConstantTernaryExpressionRule, CoupledTestCaseRule, CyclomaticComplexityRule, DeadCodeRule, DoubleCheckedLockingRule, DoubleNegativeRule, DuplicateCaseStatementRule, DuplicateNumberLiteralRule, DuplicateStringLiteralRule, ElseBlockBracesRule, EmptyCatchBlockRule, EmptyElseBlockRule, EmptyFinallyBlockRule, EmptyForStatementRule, EmptyIfStatementRule, EmptyInstanceInitializerRule, EmptyMethodInAbstractClassRule, EmptyMethodRule, EmptyStaticInitializerRule, EmptySwitchStatementRule, EmptySynchronizedStatementRule, EmptyTryBlockRule, EmptyWhileStatementRule, EqualsAndHashCodeRule, ExceptionExtendsErrorRule, ExplicitArrayListInstantiationRule, ExplicitCallToAndMethodRule, ExplicitCallToCompareToMethodRule, ExplicitCallToDivMethodRule, ExplicitCallToEqualsMethodRule, ExplicitCallToGetAtMethodRule, ExplicitCallToLeftShiftMethodRule, ExplicitCallToMinusMethodRule, ExplicitCallToModMethodRule, ExplicitCallToMultiplyMethodRule, ExplicitCallToOrMethodRule, ExplicitCallToPlusMethodRule, ExplicitCallToPowerMethodRule, ExplicitCallToRightShiftMethodRule, ExplicitCallToXorMethodRule, ExplicitGarbageCollectionRule, ExplicitHashMapInstantiationRule, ExplicitHashSetInstantiationRule, ExplicitLinkedListInstantiationRule, ExplicitStackInstantiationRule, ExplicitTreeSetInstantiationRule, FieldNameRule, FinalClassWithProtectedMemberRule, ForStatementBracesRule, GrailsPublicControllerMethodRule, GrailsServletContextReferenceRule, GrailsSessionReferenceRule, GroovyLangImmutableRule, GStringAsMapKeyRule, IfStatementBracesRule, ImplementationAsTypeRule, InconsistentPropertyLockingRule, InconsistentPropertySynchronizationRule, IntegerGetIntegerRule, InterfaceNameRule, InvertedIfElseRule, JUnitAssertAlwaysFailsRule, JUnitAssertAlwaysSucceedsRule, JUnitFailWithoutMessageRule, JUnitPublicNonTestMethodRule, JUnitSetUpCallsSuperRule, JUnitStyleAssertionsRule, JUnitTearDownCallsSuperRule, JUnitTestMethodWithoutAssertRule, JUnitUnnecessarySetUpRule, JUnitUnnecessaryTearDownRule, LoggerForDifferentClassRule, LoggerWithWrongModifiersRule, LoggingSwallowsStacktraceRule, MethodCountRule, MethodNameRule, MethodSizeRule, MissingNewInThrowStatementRule, MultipleLoggersRule, NestedBlockDepthRule, NestedSynchronizationRule, ObjectOverrideMisspelledMethodNameRule, PackageNameRule, ParameterNameRule, PrintlnRule, PrintStackTraceRule, PropertyNameRule, RemoveAllOnSelfRule, ReturnFromFinallyBlockRule, ReturnNullFromCatchBlockRule, ReturnsNullInsteadOfEmptyArrayRule, ReturnsNullInsteadOfEmptyCollectionRule, SerializableClassMustDefineSerialVersionUIDRule, SerialVersionUIDRule, SimpleDateFormatMissingLocaleRule, StatelessClassRule, StaticCalendarFieldRule, StaticDateFormatFieldRule, StaticMatcherFieldRule, SynchronizedMethodRule, SynchronizedOnBoxedPrimitiveRule, SynchronizedOnGetClassRule, SynchronizedOnReentrantLockRule, SynchronizedOnStringRule, SynchronizedOnThisRule, SynchronizedReadObjectMethodRule, SystemErrPrintRule, SystemOutPrintRule, SystemRunFinalizersOnExitRule, ThreadGroupRule, ThreadLocalNotStaticFinalRule, ThreadYieldRule, ThrowErrorRule, ThrowExceptionFromFinallyBlockRule, ThrowExceptionRule, ThrowNullPointerExceptionRule, ThrowRuntimeExceptionRule, ThrowThrowableRule, UnnecessaryBigDecimalInstantiationRule, UnnecessaryBigIntegerInstantiationRule, UnnecessaryBooleanExpressionRule, UnnecessaryBooleanInstantiationRule, UnnecessaryCallForLastElementRule, UnnecessaryCallToSubstringRule, UnnecessaryCatchBlockRule, UnnecessaryCollectCallRule, UnnecessaryCollectionCallRule, UnnecessaryConstructorRule, UnnecessaryDefInMethodDeclarationRule, UnnecessaryDoubleInstantiationRule, UnnecessaryFailRule, UnnecessaryFloatInstantiationRule, UnnecessaryGetterRule, UnnecessaryGStringRule, UnnecessaryIfStatementRule, UnnecessaryInstantiationToGetClassRule, UnnecessaryIntegerInstantiationRule, UnnecessaryLongInstantiationRule, UnnecessaryModOneRule, UnnecessaryNullCheckBeforeInstanceOfRule, UnnecessaryNullCheckRule, UnnecessaryObjectReferencesRule, UnnecessaryOverridingMethodRule, UnnecessaryPublicModifierRule, UnnecessaryReturnKeywordRule, UnnecessarySelfAssignmentRule, UnnecessarySemicolonRule, UnnecessaryStringInstantiationRule, UnnecessaryTernaryExpressionRule, UnnecessaryTransientModifierRule, UnusedArrayRule, UnusedObjectRule, UnusedPrivateFieldRule, UnusedPrivateMethodParameterRule, UnusedPrivateMethodRule, UnusedVariableRule, UseAssertEqualsInsteadOfAssertTrueRule, UseAssertFalseInsteadOfNegationRule, UseAssertNullInsteadOfAssertEqualsRule, UseAssertSameInsteadOfAssertTrueRule, UseAssertTrueInsteadOfAssertEqualsRule, UseAssertTrueInsteadOfNegationRule, UseOfNotifyMethodRule, VariableNameRule, VolatileArrayFieldRule, VolatileLongOrDoubleFieldRule, WaitOutsideOfWhileLoopRule, WhileStatementBracesRule

public abstract class AbstractAstVisitorRule
extends AbstractRule


Field Summary
protected static java.lang.Object DEFAULT_CONST_NAME
           
protected static java.lang.Object DEFAULT_FIELD_NAME
           
protected static java.lang.Object DEFAULT_TEST_CLASS_NAMES
           
protected static java.lang.Object DEFAULT_TEST_FILES
           
protected static java.lang.Object DEFAULT_VAR_NAME
           
 
Constructor Summary
AbstractAstVisitorRule()
           
 
Method Summary
 void applyTo(SourceCode sourceCode, java.util.List violations)
           
 java.lang.String getApplyToClassNames()
           
 AstVisitor getAstVisitor()
           
 java.lang.Class getAstVisitorClass()
           
 java.lang.String getDoNotApplyToClassNames()
           
 groovy.lang.MetaClass getMetaClass()
           
 java.lang.Object getProperty(java.lang.String property)
           
 java.lang.Object invokeMethod(java.lang.String method, java.lang.Object arguments)
           
 void setApplyToClassNames(java.lang.String value)
           
 void setAstVisitorClass(java.lang.Class value)
           
 void setDoNotApplyToClassNames(java.lang.String value)
           
 void setMetaClass(groovy.lang.MetaClass mc)
           
 void setProperty(java.lang.String property, java.lang.Object value)
           
protected  boolean shouldApplyThisRuleTo(java.lang.Object classNode)
           
 
Methods inherited from class org.codenarc.rule.AbstractRule
applyTo, createViolation, createViolation, createViolation, createViolation, createViolation, createViolationForImport, createViolationForImport, getApplyToFileNames, getApplyToFilesMatching, getDescription, getDoNotApplyToFileNames, getDoNotApplyToFilesMatching, getEnabled, getImportsSortedByLineNumber, getLOG, getName, getPriority, getViolationMessage, isEnabled, isReady, packageNameForImport, setApplyToFileNames, setApplyToFilesMatching, setDescription, setDoNotApplyToFileNames, setDoNotApplyToFilesMatching, setEnabled, setName, setPriority, setViolationMessage, sourceLineAndNumberForImport, sourceLineAndNumberForImport, toString, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_CONST_NAME

protected static java.lang.Object DEFAULT_CONST_NAME

DEFAULT_FIELD_NAME

protected static java.lang.Object DEFAULT_FIELD_NAME

DEFAULT_VAR_NAME

protected static java.lang.Object DEFAULT_VAR_NAME

DEFAULT_TEST_FILES

protected static java.lang.Object DEFAULT_TEST_FILES

DEFAULT_TEST_CLASS_NAMES

protected static java.lang.Object DEFAULT_TEST_CLASS_NAMES
Constructor Detail

AbstractAstVisitorRule

public AbstractAstVisitorRule()
Method Detail

getMetaClass

public groovy.lang.MetaClass getMetaClass()
Specified by:
getMetaClass in interface groovy.lang.GroovyObject
Overrides:
getMetaClass in class AbstractRule

setMetaClass

public void setMetaClass(groovy.lang.MetaClass mc)
Specified by:
setMetaClass in interface groovy.lang.GroovyObject
Overrides:
setMetaClass in class AbstractRule

invokeMethod

public java.lang.Object invokeMethod(java.lang.String method,
                                     java.lang.Object arguments)
Specified by:
invokeMethod in interface groovy.lang.GroovyObject
Overrides:
invokeMethod in class AbstractRule

getProperty

public java.lang.Object getProperty(java.lang.String property)
Specified by:
getProperty in interface groovy.lang.GroovyObject
Overrides:
getProperty in class AbstractRule

setProperty

public void setProperty(java.lang.String property,
                        java.lang.Object value)
Specified by:
setProperty in interface groovy.lang.GroovyObject
Overrides:
setProperty in class AbstractRule

getAstVisitorClass

public java.lang.Class getAstVisitorClass()

setAstVisitorClass

public void setAstVisitorClass(java.lang.Class value)

getApplyToClassNames

public java.lang.String getApplyToClassNames()

setApplyToClassNames

public void setApplyToClassNames(java.lang.String value)

getDoNotApplyToClassNames

public java.lang.String getDoNotApplyToClassNames()

setDoNotApplyToClassNames

public void setDoNotApplyToClassNames(java.lang.String value)

getAstVisitor

public AstVisitor getAstVisitor()

applyTo

public void applyTo(SourceCode sourceCode,
                    java.util.List violations)
Specified by:
applyTo in class AbstractRule

shouldApplyThisRuleTo

protected boolean shouldApplyThisRuleTo(java.lang.Object classNode)


Copyright © 2011. All Rights Reserved.