com.puppycrawl.tools.checkstyle.filters
Class SuppressionCommentFilter
- Configurable, Contextualizable, Filter
public class SuppressionCommentFilter
A filter that uses comments to suppress audit events.
Rationale:
Sometimes there are legitimate reasons for violating a check. When
this is a matter of the code in question and not personal
preference, the best place to override the policy is in the code
itself. Semi-structured comments can be associated with the check.
This is sometimes superior to a separate suppressions file, which
must be kept up-to-date as the source file is edited.
Usage:
This check only works in conjunction with the FileContentsHolder module
since that module makes the suppression comments in the .java
files available
sub rosa.
class | SuppressionCommentFilter.Tag - A Tag holds a suppression comment and its location, and determines
whether the supression turns checkstyle reporting on or off.
|
SuppressionCommentFilter
public SuppressionCommentFilter()
Constructs a SuppressionCommentFilter.
Initializes comment on, comment off, and check formats
to defaults.
getFileContents
public FileContents getFileContents()
- the FileContents for this filter.
setCheckC
public void setCheckC(boolean aCheckC)
Set whether to look in C comments.
aCheckC
- true
if C comments are checked.
setCheckCPP
public void setCheckCPP(boolean aCheckCPP)
Set whether to look in C++ comments.
aCheckCPP
- true
if C++ comments are checked.
setCheckFormat
public void setCheckFormat(String aFormat)
throws ConversionException
Set the format for a check.
setFileContents
public void setFileContents(FileContents aFileContents)
Set the FileContents for this filter.
aFileContents
- the FileContents for this filter.
setMessageFormat
public void setMessageFormat(String aFormat)
throws ConversionException
Set the format for a message.
setOffCommentFormat
public void setOffCommentFormat(String aFormat)
throws ConversionException
Set the format for a comment that turns off reporting.
aFormat
- a String
value.
setOnCommentFormat
public void setOnCommentFormat(String aFormat)
throws ConversionException
Set the format for a comment that turns on reporting.