|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Rule
This is the basic Rule interface for PMD rules.
Field Summary | |
---|---|
static StringProperty |
VIOLATION_SUPPRESS_REGEX_DESCRIPTOR
The property descriptor to universally suppress violations with messages matching a regular expression. |
static StringProperty |
VIOLATION_SUPPRESS_XPATH_DESCRIPTOR
Name of the property to universally suppress violations on nodes which match a given relative XPath expression. |
Method Summary | |
---|---|
void |
addExample(java.lang.String example)
Add a single example for this Rule. |
void |
addRuleChainVisit(java.lang.Class<? extends Node> nodeClass)
Adds an AST node by class to be visited by the Rule on the RuleChain. |
void |
addRuleChainVisit(java.lang.String astNodeName)
Adds an AST node by name to be visited by the Rule on the RuleChain. |
void |
apply(java.util.List<? extends Node> nodes,
RuleContext ctx)
Apply this rule to the given collection of nodes, using the given context. |
void |
end(RuleContext ctx)
End processing. |
java.lang.String |
getDescription()
Get the description of this Rule. |
java.util.List<java.lang.String> |
getExamples()
Get the list of examples for this Rule. |
java.lang.String |
getExternalInfoUrl()
Get a URL for external information about this Rule. |
Language |
getLanguage()
Get the Language of this Rule. |
LanguageVersion |
getMaximumLanguageVersion()
Get the maximum LanguageVersion to which this Rule applies. |
java.lang.String |
getMessage()
Get the message to show when this Rule identifies a violation. |
LanguageVersion |
getMinimumLanguageVersion()
Get the minimum LanguageVersion to which this Rule applies. |
java.lang.String |
getName()
Get the name of this Rule. |
ParserOptions |
getParserOptions()
Get the parser options for this Rule. |
RulePriority |
getPriority()
Get the priority of this Rule. |
java.util.List<java.lang.String> |
getRuleChainVisits()
Gets the collection of AST node names visited by the Rule on the RuleChain. |
java.lang.String |
getRuleClass()
Get the implementation class of this Rule. |
java.lang.String |
getRuleSetName()
Get the name of the RuleSet containing this Rule. |
java.lang.String |
getSince()
Get the version of PMD in which this Rule was added. |
boolean |
isDeprecated()
Gets whether this Rule is deprecated. |
void |
setDeprecated(boolean deprecated)
Sets whether this Rule is deprecated. |
void |
setDescription(java.lang.String description)
Set the description of this Rule. |
void |
setExternalInfoUrl(java.lang.String externalInfoUrl)
Set a URL for external information about this Rule. |
void |
setLanguage(Language language)
Set the Language of this Rule. |
void |
setMaximumLanguageVersion(LanguageVersion maximumLanguageVersion)
Set the maximum LanguageVersion to which this Rule applies. |
void |
setMessage(java.lang.String message)
Set the message to show when this Rule identifies a violation. |
void |
setMinimumLanguageVersion(LanguageVersion minimumLanguageVersion)
Set the minimum LanguageVersion to which this Rule applies. |
void |
setName(java.lang.String name)
Set the name of this Rule. |
void |
setPriority(RulePriority priority)
Set the priority of this Rule. |
void |
setRuleClass(java.lang.String ruleClass)
Set the class of this Rule. |
void |
setRuleSetName(java.lang.String name)
Set the name of the RuleSet containing this Rule. |
void |
setSince(java.lang.String since)
Set the version of PMD in which this Rule was added. |
void |
setUsesDFA()
Sets whether this Rule uses Data Flow Analysis. |
void |
setUsesTypeResolution()
Sets whether this Rule uses Type Resolution. |
void |
start(RuleContext ctx)
Start processing. |
boolean |
usesDFA()
Gets whether this Rule uses Data Flow Analysis. |
boolean |
usesRuleChain()
Gets whether this Rule uses the RuleChain. |
boolean |
usesTypeResolution()
Gets whether this Rule uses Type Resolution. |
Methods inherited from interface net.sourceforge.pmd.PropertySource |
---|
definePropertyDescriptor, dysfunctionReason, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, setProperty, useDefaultValueFor, usesDefaultValues |
Field Detail |
---|
static final StringProperty VIOLATION_SUPPRESS_REGEX_DESCRIPTOR
static final StringProperty VIOLATION_SUPPRESS_XPATH_DESCRIPTOR
Method Detail |
---|
Language getLanguage()
void setLanguage(Language language)
language
- the languageLanguageVersion getMinimumLanguageVersion()
null
it indicates there is no minimum bound.
void setMinimumLanguageVersion(LanguageVersion minimumLanguageVersion)
minimumLanguageVersion
- the minimum language versionLanguageVersion getMaximumLanguageVersion()
null
it indicates there is no maximum bound.
void setMaximumLanguageVersion(LanguageVersion maximumLanguageVersion)
maximumLanguageVersion
- the maximum language versionboolean isDeprecated()
true
if this rule is deprecatedvoid setDeprecated(boolean deprecated)
deprecated
- whether this rule is deprecatedjava.lang.String getName()
void setName(java.lang.String name)
name
- the namejava.lang.String getSince()
null
if not applicable.
void setSince(java.lang.String since)
since
- the version of PMD since when this rule was addedjava.lang.String getRuleClass()
void setRuleClass(java.lang.String ruleClass)
ruleClass
- the class name of this rule.java.lang.String getRuleSetName()
RuleSet
void setRuleSetName(java.lang.String name)
name
- the name of the ruleset containing this rule.RuleSet
java.lang.String getMessage()
void setMessage(java.lang.String message)
message
- the message to show for a violation.java.lang.String getDescription()
void setDescription(java.lang.String description)
description
- the descriptionjava.util.List<java.lang.String> getExamples()
void addExample(java.lang.String example)
example
- a single example to addjava.lang.String getExternalInfoUrl()
void setExternalInfoUrl(java.lang.String externalInfoUrl)
externalInfoUrl
- the URL for external information about this rule.RulePriority getPriority()
void setPriority(RulePriority priority)
priority
- the priorityParserOptions getParserOptions()
Parser
to create an AST in the form the Rule is
expecting. Because ParserOptions are mutable, a Rule should return a new
instance on each call.
void setUsesDFA()
boolean usesDFA()
true
if Data Flow Analysis is used.void setUsesTypeResolution()
boolean usesTypeResolution()
true
if Type Resolution is used.boolean usesRuleChain()
true
if RuleChain is used.java.util.List<java.lang.String> getRuleChainVisits()
void addRuleChainVisit(java.lang.Class<? extends Node> nodeClass)
nodeClass
- the AST node to add to the RuleChain visit listvoid addRuleChainVisit(java.lang.String astNodeName)
astNodeName
- the AST node to add to the RuleChain visit list as
stringvoid start(RuleContext ctx)
ctx
- the rule contextvoid apply(java.util.List<? extends Node> nodes, RuleContext ctx)
nodes
- the nodesctx
- the rule contextvoid end(RuleContext ctx)
ctx
- the rule context
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |