Class SuppressFilterElement
java.lang.Object
com.puppycrawl.tools.checkstyle.filters.SuppressFilterElement
- All Implemented Interfaces:
Filter
This filter element is immutable and processes
AuditEvent
objects based on the criteria of file, check, module id, line, and
column. It rejects an AuditEvent if the following match:
- the event's file name; and
- the check name or the module identifier; and
- (optionally) the event's line is in the filter's line CSV; and
- (optionally) the check's columns is in the filter's column CSV.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringThe pattern for check class names.private final PatternThe regexp to match check names against.private final CsvFilterElementColumn number filter.private final StringCSV for column number filter.private final StringThe pattern for file names.private final PatternThe regexp to match file names against.private final CsvFilterElementLine number filter.private final StringCSV for line number filter.private final StringThe pattern for message names.private final PatternThe regexp to match message names against.private final StringModule id filter. -
Constructor Summary
ConstructorsConstructorDescriptionSuppressFilterElement(String files, String checks, String message, String modId, String lines, String columns) Constructs aSuppressFilterElementfor a file name pattern.SuppressFilterElement(Pattern files, Pattern checks, Pattern message, String moduleId, String lines, String columns) Creates aSuppressFilterElementinstance. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccept(AuditEvent event) Determines whether or not a filtered AuditEvent is accepted.booleaninthashCode()private booleanIs matching by file name, module id, and Check name.private booleanWhether line and column match.private booleanisMessageNameMatching(AuditEvent event) Is matching by message.
-
Field Details
-
fileRegexp
The regexp to match file names against. -
filePattern
The pattern for file names. -
checkRegexp
The regexp to match check names against. -
checkPattern
The pattern for check class names. -
messageRegexp
The regexp to match message names against. -
messagePattern
The pattern for message names. -
moduleId
Module id filter. -
lineFilter
Line number filter. -
linesCsv
CSV for line number filter. -
columnFilter
Column number filter. -
columnsCsv
CSV for column number filter.
-
-
Constructor Details
-
SuppressFilterElement
public SuppressFilterElement(String files, String checks, String message, String modId, String lines, String columns) Constructs aSuppressFilterElementfor a file name pattern.- Parameters:
files- regular expression for names of filtered files.checks- regular expression for filtered check classes.message- regular expression for messages.modId- the idlines- lines CSV values and ranges for line number filtering.columns- columns CSV values and ranges for column number filtering.
-
SuppressFilterElement
public SuppressFilterElement(Pattern files, Pattern checks, Pattern message, String moduleId, String lines, String columns) Creates aSuppressFilterElementinstance.- Parameters:
files- regular expression for filtered file nameschecks- regular expression for filtered check classesmessage- regular expression for messages.moduleId- the module idlines- CSV for linescolumns- CSV for columns
-
-
Method Details
-
accept
Description copied from interface:FilterDetermines whether or not a filtered AuditEvent is accepted. -
isFileNameAndModuleNameMatching
Is matching by file name, module id, and Check name.- Parameters:
event- event- Returns:
- true if it is matching
-
isMessageNameMatching
Is matching by message.- Parameters:
event- event- Returns:
- true if it is matching or not set.
-
isLineAndColumnMatching
Whether line and column match.- Parameters:
event- event to process.- Returns:
- true if line and column are matching or not set.
-
hashCode
public int hashCode() -
equals
-