Package net.sourceforge.pmd.reporting
Interface ViolationSuppressor
-
public interface ViolationSuppressor
An object that suppresses rule violations. Suppressors are used byRuleContext
to filter out violations. In PMD 6.0.x, theReport
object filtered violations itself - but it has no knowledge of language-specific suppressors.
-
-
Field Summary
Fields Modifier and Type Field Description static ViolationSuppressor
NOPMD_COMMENT_SUPPRESSOR
Suppressor for regular NOPMD comments.static ViolationSuppressor
REGEX_SUPPRESSOR
Suppressor for the violationSuppressRegex property.static ViolationSuppressor
XPATH_SUPPRESSOR
Suppressor for the violationSuppressXPath property.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getId()
A name, for reporting and documentation purposes.static @Nullable Report.SuppressedViolation
suppressOrNull(List<ViolationSuppressor> suppressorList, RuleViolation rv, Node node)
Apply a list of suppressors on the violation.@Nullable Report.SuppressedViolation
suppressOrNull(RuleViolation rv, @NonNull Node node)
Returns aReport.SuppressedViolation
if the given violation is suppressed by this object.
-
-
-
Field Detail
-
REGEX_SUPPRESSOR
static final ViolationSuppressor REGEX_SUPPRESSOR
Suppressor for the violationSuppressRegex property.
-
XPATH_SUPPRESSOR
static final ViolationSuppressor XPATH_SUPPRESSOR
Suppressor for the violationSuppressXPath property.
-
NOPMD_COMMENT_SUPPRESSOR
static final ViolationSuppressor NOPMD_COMMENT_SUPPRESSOR
Suppressor for regular NOPMD comments.- Implementation Note:
- This requires special support from the language, namely,
the parser must fill-in
AstInfo.getSuppressionComments()
.
-
-
Method Detail
-
getId
String getId()
A name, for reporting and documentation purposes.
-
suppressOrNull
@Nullable Report.SuppressedViolation suppressOrNull(RuleViolation rv, @NonNull Node node)
Returns aReport.SuppressedViolation
if the given violation is suppressed by this object. The node and the rule are provided for context. Returns null if the violation is not suppressed.
-
suppressOrNull
static @Nullable Report.SuppressedViolation suppressOrNull(List<ViolationSuppressor> suppressorList, RuleViolation rv, Node node)
Apply a list of suppressors on the violation. Returns the violation of the first suppressor that matches the input violation. If no suppressor matches, then returns null.
-
-