|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.puppycrawl.tools.checkstyle.api.AutomaticBean com.puppycrawl.tools.checkstyle.filters.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.
FileContentsHolder
Nested Class Summary | |
class |
SuppressionCommentFilter.Tag
A Tag holds a suppression comment and its location, and determines whether the supression turns checkstyle reporting on or off. |
Constructor Summary | |
SuppressionCommentFilter()
Constructs a SuppressionCommentFilter. |
Method Summary | |
boolean |
accept(AuditEvent aEvent)
Determines whether or not a filtered AuditEvent is accepted. |
protected void |
finishLocalSetup()
Check that everything was set up properly. |
FileContents |
getFileContents()
|
void |
setCheckC(boolean aCheckC)
Set whether to look in C comments. |
void |
setCheckCPP(boolean aCheckCPP)
Set whether to look in C++ comments. |
void |
setCheckFormat(java.lang.String aFormat)
Set the format for a check. |
void |
setFileContents(FileContents aFileContents)
Set the FileContents for this filter. |
void |
setMessageFormat(java.lang.String aFormat)
Set the format for a message. |
void |
setOffCommentFormat(java.lang.String aFormat)
Set the format for a comment that turns off reporting. |
void |
setOnCommentFormat(java.lang.String aFormat)
Set the format for a comment that turns on reporting. |
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean |
configure, contextualize, getConfiguration, setupChild |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SuppressionCommentFilter()
Method Detail |
public void setOffCommentFormat(java.lang.String aFormat) throws org.apache.commons.beanutils.ConversionException
aFormat
- a String
value.
org.apache.commons.beanutils.ConversionException
- unable to parse aFormat.public void setOnCommentFormat(java.lang.String aFormat) throws org.apache.commons.beanutils.ConversionException
aFormat
- a String
value
org.apache.commons.beanutils.ConversionException
- unable to parse aFormatpublic FileContents getFileContents()
public void setFileContents(FileContents aFileContents)
aFileContents
- the FileContents for this filter.public void setCheckFormat(java.lang.String aFormat) throws org.apache.commons.beanutils.ConversionException
aFormat
- a String
value
org.apache.commons.beanutils.ConversionException
- unable to parse aFormatpublic void setMessageFormat(java.lang.String aFormat) throws org.apache.commons.beanutils.ConversionException
aFormat
- a String
value
org.apache.commons.beanutils.ConversionException
- unable to parse aFormatpublic void setCheckCPP(boolean aCheckCPP)
aCheckCPP
- true
if C++ comments are checked.public void setCheckC(boolean aCheckC)
aCheckC
- true
if C comments are checked.public boolean accept(AuditEvent aEvent)
Filter
accept
in interface Filter
aEvent
- the AudtiEvent to filter.
Filter
protected void finishLocalSetup() throws CheckstyleException
finishLocalSetup
in class AutomaticBean
CheckstyleException
- if a comment format was not set
|
Back to the Checkstyle Home Page | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |