Type Params | Return Type | Name and description |
---|---|---|
|
public abstract void |
applyTo(SourceCode sourceCode, java.util.List<Violation> violations) Apply this rule to the specified source and return a list of violations (or an empty List) |
|
public java.util.List<Violation> |
applyTo(SourceCode sourceCode) Apply this rule to the specified source and return a list of violations (or an empty List). |
|
protected Violation |
createViolation(java.lang.Integer lineNumber, java.lang.String sourceLine, java.lang.String message) Create and return a new Violation for this rule and the specified values |
|
protected Violation |
createViolation(SourceCode sourceCode, ASTNode node, java.lang.String message) Create a new Violation for the AST node. |
|
protected Violation |
createViolationForImport(SourceCode sourceCode, org.codehaus.groovy.ast.ImportNode importNode, java.lang.String message) Create and return a new Violation for this rule and the specified import |
|
protected Violation |
createViolationForImport(SourceCode sourceCode, java.lang.String className, java.lang.String alias, java.lang.String violationMessage) Create and return a new Violation for this rule and the specified import className and alias |
|
public java.lang.String |
getApplyToFileNames() |
|
public java.lang.String |
getApplyToFilesMatching() |
|
public int |
getCompilerPhase()
|
|
public java.lang.String |
getDescription() |
|
public java.lang.String |
getDoNotApplyToFileNames() |
|
public java.lang.String |
getDoNotApplyToFilesMatching() |
|
public abstract java.lang.String |
getName()
|
|
public abstract int |
getPriority()
|
|
public java.lang.String |
getViolationMessage() |
|
public boolean |
isEnabled() |
|
public boolean |
isReady() Allows rules to check whether preconditions are satisfied and short-circuit execution (i.e., do nothing) if those preconditions are not satisfied. |
|
public void |
setApplyToFileNames(java.lang.String applyToFileNames) |
|
public void |
setApplyToFilesMatching(java.lang.String applyToFilesMatching) |
|
public void |
setDescription(java.lang.String description) |
|
public void |
setDoNotApplyToFileNames(java.lang.String doNotApplyToFileNames) |
|
public void |
setDoNotApplyToFilesMatching(java.lang.String doNotApplyToFilesMatching) |
|
public void |
setEnabled(boolean enabled) |
|
public abstract void |
setName(java.lang.String name) Set the unique name for this rule |
|
public abstract void |
setPriority(int priority) Set the priority for this rule |
|
public void |
setViolationMessage(java.lang.String violationMessage) |
|
public java.lang.String |
toString() |
|
public void |
validate() Allows rules to perform validation. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Apply this rule to the specified source and return a list of violations (or an empty List)
sourceCode
- - the source to apply this rule toviolations
- - the List of violations to which new violations from this rule are to be addedApply this rule to the specified source and return a list of violations (or an empty List). This implementation delegates to the abstract applyCode(SourceCode,List), provided by concrete subclasses. This template method simplifies subclass implementations and also enables common handling of enablement logic.
sourceCode
- - the source to apply this rule toCreate and return a new Violation for this rule and the specified values
lineNumber
- - the line number for the violation; may be nullsourceLine
- - the source line for the violation; may be nullmessage
- - the message for the violation; may be nullCreate a new Violation for the AST node.
sourceCode
- - the SourceCodenode
- - the Groovy AST Nodemessage
- - the message for the violation; defaults to nullCreate and return a new Violation for this rule and the specified import
sourceCode
- - the SourceCodeimportNode
- - the ImportNode for the import triggering the violationCreate and return a new Violation for this rule and the specified import className and alias
sourceCode
- - the SourceCodeclassName
- - the class name (as specified within the import statement)alias
- - the alias for the import statementviolationMessage
- - the violation message; may be null
Allows rules to check whether preconditions are satisfied and short-circuit execution (i.e., do nothing) if those preconditions are not satisfied. Return true by default. This method is provided as a placeholder so subclasses can optionally override.
Set the unique name for this rule
name
- - the name for this rule; this should be uniqueSet the priority for this rule
priority
- - the priority of this rule, between 1 (highest priority) and 3 (lowest priority), inclusive. Allows rules to perform validation. Do nothing by default.
This method is provided as a placeholder so subclasses can optionally override.
Subclasses will typically use assert
calls to verify required preconditions.