SeverityMatchFilter
Since Checkstyle 3.2
Description
Notes
SeverityMatchFilter can suppress Checks that have Treewalker or Checker as parent module.
In Checkstyle, when a filter accepts a violation (i.e. accept() returns true), the violation is kept in the final report; to make a violation disappear from the report, the filter must reject it by returning false. For SeverityMatchFilter, set severity to the level you want to control and acceptOnMatch to true to keep matching violations in the final report, or to false to remove them from it.
Properties
| name | description | type | default value | since |
|---|---|---|---|---|
| acceptOnMatch | Control whether the filter accepts an audit event if and only if there is a match between the event's severity level and property severity. If acceptOnMatch is false, then the filter accepts an audit event if and only if there is not a match between the event's severity level and property severity. |
boolean | true |
3.2 |
| severity | Specify the severity level of this filter. | SeverityLevel | error |
3.2 |
Examples
Ignore audit events with severity level info:
<module name="Checker">
<module name="TreeWalker">
<module name="ParameterName">
<property name="severity" value="info"/>
</module>
<module name="MethodName"/>
</module>
<module name="SeverityMatchFilter">
<property name="severity" value="info"/>
<property name="acceptOnMatch" value="false"/>
</module>
</module>
Example code:
public class Example1 {
// filtered violation below 'must match pattern'
public void method1(int V1){} // ok, ParameterName's severity is info
public void Method2(){} // violation, MethodName's severity is defaulted to error
}
Example of Usage
Fully Qualified Name
com.puppycrawl.tools.checkstyle.filters.SeverityMatchFilter
This is the fully qualified class name of the module. Use this name in configuration when an exact class reference is required.






