Class SuppressElement
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.filters.SuppressElement
-
- All Implemented Interfaces:
Filter
public class SuppressElement extends Object implements Filter
This filter processesAuditEvent
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.
- Author:
- Rick Giles
-
-
Constructor Summary
Constructors Constructor Description SuppressElement(String files)
Constructs aSuppressElement
for a file name pattern.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(AuditEvent event)
Determines whether or not a filtered AuditEvent is accepted.boolean
equals(Object other)
int
hashCode()
void
setChecks(String checks)
Set the check class pattern.void
setColumns(String columns)
Sets the CSV values and ranges for column number filtering.void
setLines(String lines)
Sets the CSV values and ranges for line number filtering.void
setModuleId(String moduleId)
Set the module id for filtering.
-
-
-
Constructor Detail
-
SuppressElement
public SuppressElement(String files)
Constructs aSuppressElement
for a file name pattern. Must either callsetColumns(String)
orsetModuleId(String)
before using this object.- Parameters:
files
- regular expression for names of filtered files.
-
-
Method Detail
-
setChecks
public void setChecks(String checks)
Set the check class pattern.- Parameters:
checks
- regular expression for filtered check classes.
-
setModuleId
public void setModuleId(String moduleId)
Set the module id for filtering. Cannot be null.- Parameters:
moduleId
- the id
-
setLines
public void setLines(String lines)
Sets the CSV values and ranges for line number filtering. E.g. "1,7-15,18".- Parameters:
lines
- CSV values and ranges for line number filtering.
-
setColumns
public void setColumns(String columns)
Sets the CSV values and ranges for column number filtering. E.g. "1,7-15,18".- Parameters:
columns
- CSV values and ranges for column number filtering.
-
accept
public boolean accept(AuditEvent event)
Description copied from interface:Filter
Determines whether or not a filtered AuditEvent is accepted.
-
-