SeverityMatchFilter

Since Checkstyle 3.2

Description

Filter SeverityMatchFilter decides audit events according to the severity level of the event.

Notes

SeverityMatchFilter can suppress Checks that have Treewalker or Checker as parent module.

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

For example, the following configuration fragment directs the Checker to not report 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 {
  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

Package

com.puppycrawl.tools.checkstyle.filters

Parent Module

Checker