Class AbstractSharedAstVisitorRule
java.lang.Object
org.codenarc.rule.AbstractRule
org.codenarc.rule.AbstractAstVisitorRule
org.codenarc.rule.AbstractSharedAstVisitorRule
- All Implemented Interfaces:
Rule
- Direct Known Subclasses:
PrivateFieldCouldBeFinalRule, UnusedPrivateFieldRule, UnusedPrivateMethodRule
Abstract superclass for Rules that use a single, shared AstVisitor across all ClassNodes in a source (file).
-
Field Summary
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
Modifier and TypeMethodDescriptionvoidapplyTo(SourceCode sourceCode, List<Violation> violations) Apply this rule to the specified source and return a list of violations (or an empty List)protected voidapplyVisitor(AstVisitor visitor, SourceCode sourceCode) protected AstVisitorgetAstVisitor(SourceCode sourceCode) Subclasses can override to provide an AstVisitor with SourceCode or AST-specific initialization.getViolations(AstVisitor astVisitor, SourceCode sourceCode) removeSuppressedViolations(List<Violation> violations, SourceCode sourceCode) Methods inherited from class AbstractAstVisitorRule
getApplyToClassNames, getAstVisitor, getAstVisitorClass, getDoNotApplyToClassNames, setApplyToClassNames, setDoNotApplyToClassNames, shouldApplyThisRuleToMethods inherited from class AbstractRule
applyTo, createViolation, createViolation, createViolationForImport, createViolationForImport, getApplyToFileNames, getApplyToFilesMatching, getCompilerPhase, getDescription, getDoNotApplyToFileNames, getDoNotApplyToFilesMatching, getName, getPriority, getViolationMessage, isEnabled, isReady, setApplyToFileNames, setApplyToFilesMatching, setDescription, setDoNotApplyToFileNames, setDoNotApplyToFilesMatching, setEnabled, setName, setPriority, setViolationMessage, toString, validate
-
Constructor Details
-
AbstractSharedAstVisitorRule
public AbstractSharedAstVisitorRule()
-
-
Method Details
-
getViolations
-
applyTo
Description copied from class:AbstractRuleApply this rule to the specified source and return a list of violations (or an empty List)- Overrides:
applyToin classAbstractAstVisitorRule- Parameters:
sourceCode- - the source to apply this rule toviolations- - the List of violations to which new violations from this rule are to be added
-
getAstVisitor
Subclasses can override to provide an AstVisitor with SourceCode or AST-specific initialization. -
applyVisitor
-
removeSuppressedViolations
private List<Violation> removeSuppressedViolations(List<Violation> violations, SourceCode sourceCode)
-