public class SuppressWithNearbyCommentFilter extends AutomaticBean implements Filter
A filter that uses nearby comments to suppress audit events.
This check is philosophically similar to SuppressionCommentFilter
.
Unlike SuppressionCommentFilter
, this filter does not require
pairs of comments. This check may be used to suppress warnings in the
current line:
offendingLine(for, whatever, reason); // SUPPRESS ParameterNumberCheckor it may be configured to span multiple lines, either forward:
// PERMIT MultipleVariableDeclarations NEXT 3 LINES double x1 = 1.0, y1 = 0.0, z1 = 0.0; double x2 = 0.0, y2 = 1.0, z2 = 0.0; double x3 = 0.0, y3 = 0.0, z3 = 1.0;or reverse:
try { thirdPartyLibrary.method(); } catch (RuntimeException e) { // ALLOW ILLEGAL CATCH BECAUSE third party API wraps everything // in RuntimeExceptions. ... }
See SuppressionCommentFilter
for usage notes.
Modifier and Type | Class and Description |
---|---|
class |
SuppressWithNearbyCommentFilter.Tag
A Tag holds a suppression comment and its location.
|
Constructor and Description |
---|
SuppressWithNearbyCommentFilter()
Constructs a SuppressionCommentFilter.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(AuditEvent event)
Determines whether or not a filtered AuditEvent is accepted.
|
FileContents |
getFileContents() |
void |
setCheckC(boolean checkC)
Set whether to look in C comments.
|
void |
setCheckCPP(boolean checkCPP)
Set whether to look in C++ comments.
|
void |
setCheckFormat(String format)
Set the format for a check.
|
void |
setCommentFormat(String format)
Set the format for a comment that turns off reporting.
|
void |
setFileContents(FileContents fileContents)
Set the FileContents for this filter.
|
void |
setInfluenceFormat(String format)
Set the format for the influence of this check.
|
void |
setMessageFormat(String format)
Set the format for a message.
|
configure, contextualize, finishLocalSetup, getConfiguration, setupChild
public SuppressWithNearbyCommentFilter()
public void setCommentFormat(String format) throws org.apache.commons.beanutils.ConversionException
format
- a String
value.org.apache.commons.beanutils.ConversionException
- unable to parse format.public FileContents getFileContents()
public void setFileContents(FileContents fileContents)
fileContents
- the FileContents for this filter.public void setCheckFormat(String format) throws org.apache.commons.beanutils.ConversionException
format
- a String
valueorg.apache.commons.beanutils.ConversionException
- unable to parse formatpublic void setMessageFormat(String format) throws org.apache.commons.beanutils.ConversionException
format
- a String
valueorg.apache.commons.beanutils.ConversionException
- unable to parse formatpublic void setInfluenceFormat(String format) throws org.apache.commons.beanutils.ConversionException
format
- a String
valueorg.apache.commons.beanutils.ConversionException
- unable to parse formatpublic void setCheckCPP(boolean checkCPP)
checkCPP
- true
if C++ comments are checked.public void setCheckC(boolean checkC)
checkC
- true
if C comments are checked.public boolean accept(AuditEvent event)
Copyright © 2001–2015. All rights reserved.