Class SuppressWithNearbyTextFilter

java.lang.Object
com.puppycrawl.tools.checkstyle.AbstractAutomaticBean
com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyTextFilter
All Implemented Interfaces:
Configurable, Contextualizable, Filter

Filter SuppressWithNearbyTextFilter uses plain text to suppress nearby audit events. The filter can suppress all checks which have Checker as a parent module.

Setting .* value to nearbyTextPattern property will see any text as a suppression and will likely suppress all audit events in the file. It is best to set this to a key phrase not commonly used in the file to help denote it out of the rest of the file as a suppression. See the default value as an example.

  • Property checkPattern - Specify check name pattern to suppress. Property can also be a RegExp group index at nearbyTextPattern in format of $x and be picked from line that matches nearbyTextPattern. Type is java.util.regex.Pattern. Default value is ".*".
  • Property idPattern - Specify check ID pattern to suppress. Type is java.util.regex.Pattern. Default value is null.
  • Property lineRange - Specify negative/zero/positive value that defines the number of lines preceding/at/following the suppressing nearby text. Property can also be a RegExp group index at nearbyTextPattern in format of $x and be picked from line that matches nearbyTextPattern. Type is java.lang.String. Default value is "0".
  • Property messagePattern - Specify check violation message pattern to suppress. Type is java.util.regex.Pattern. Default value is null.
  • Property nearbyTextPattern - Specify nearby text pattern to trigger filter to begin suppression. Type is java.util.regex.Pattern. Default value is "SUPPRESS CHECKSTYLE (\w+)".

Parent is com.puppycrawl.tools.checkstyle.Checker

Since:
10.10.0