Class AbstractEnhanceableAstVisitorRule
java.lang.Object
org.codenarc.rule.AbstractRule
org.codenarc.rule.AbstractAstVisitorRule
org.codenarc.rule.AbstractEnhanceableAstVisitorRule
- All Implemented Interfaces:
Rule
- Direct Known Subclasses:
CloseWithoutCloseableRule, CompareToWithoutComparableRule
Abstract superclass for Rules that use a Groovy AST Visitor and can optionally run in enhanced mode.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringHolds the name of the system property which allows to control theenhancedModeproperty.private booleanControls weather to run in enhanced mode.Fields inherited from class AbstractAstVisitorRule
CLOSURE_TEXT, DEFAULT_CONST_NAME, DEFAULT_FIELD_NAME, DEFAULT_TEST_CLASS_NAMES, DEFAULT_TEST_FILES, DEFAULT_VAR_NAME -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class AbstractAstVisitorRule
applyTo, getApplyToClassNames, getAstVisitor, getAstVisitorClass, getDoNotApplyToClassNames, setApplyToClassNames, setDoNotApplyToClassNames, shouldApplyThisRuleToMethods inherited from class AbstractRule
applyTo, createViolation, createViolation, createViolationForImport, createViolationForImport, getApplyToFileNames, getApplyToFilesMatching, getDescription, getDoNotApplyToFileNames, getDoNotApplyToFilesMatching, getName, getPriority, getViolationMessage, isEnabled, isReady, setApplyToFileNames, setApplyToFilesMatching, setDescription, setDoNotApplyToFileNames, setDoNotApplyToFilesMatching, setEnabled, setName, setPriority, setViolationMessage, toString, validate
-
Field Details
-
ENHANCED_MODE_SYSTEM_PROPERTY
Holds the name of the system property which allows to control theenhancedModeproperty.- See Also:
-
enhancedMode
private boolean enhancedModeControls weather to run in enhanced mode. Note that running in enhanced mode will use a later compilation phase which will require any classes referenced from the analysed code to be available on the classpath. This property is set tofalseby default and can be also controlled usingorg.codenarc.enhancedModesystem property.
-
-
Constructor Details
-
AbstractEnhanceableAstVisitorRule
public AbstractEnhanceableAstVisitorRule()
-
-
Method Details
-
isEnhancedMode
public boolean isEnhancedMode() -
setEnhancedMode
public void setEnhancedMode(boolean enhancedMode) -
getCompilerPhase
public int getCompilerPhase()- Specified by:
getCompilerPhasein interfaceRule- Overrides:
getCompilerPhasein classAbstractRule- Returns:
- the required compiler phase (as in
Phases) of the AST of theSourceCodehanded to the rule viaAbstractRule.applyTo(SourceCode sourceCode)
-