Class SeverityMatchFilter
java.lang.Object
com.puppycrawl.tools.checkstyle.AbstractAutomaticBean
com.puppycrawl.tools.checkstyle.filters.SeverityMatchFilter
- All Implemented Interfaces:
Configurable,Contextualizable,Filter
Accept violation to be present in audit report according to the
severity level.
Notes: SeverityMatchFilter can suppress Checks that have Treewalker or Checker as parent module.
In Checkstyle, when a filter accepts a violation
(i.e. accept() returns true), the violation is kept in the
final report; to make a violation disappear from the report, the filter must
reject it by returning false. For SeverityMatchFilter, set
severity to the level you want to control and acceptOnMatch
to true to keep matching violations in the final report, or to
false to remove them from it.
- Since:
- 3.2
-
Nested Class Summary
Nested classes/interfaces inherited from class com.puppycrawl.tools.checkstyle.AbstractAutomaticBean
AbstractAutomaticBean.OutputStreamOptions -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanControl whether the filter accepts an audit event if and only if there is a match between the event's severity level and property severity.private SeverityLevelSpecify the severity level of this filter. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccept(AuditEvent event) Determines whether or not a filtered AuditEvent is accepted.protected voidProvides a hook to finish the part of this component's setup that was not handled by the bean introspection.final voidsetAcceptOnMatch(boolean acceptOnMatch) Setter to control whether the filter accepts an audit event if and only if there is a match between the event's severity level and property severity.final voidsetSeverity(SeverityLevel severity) Setter to specify the severity level of this filter.Methods inherited from class com.puppycrawl.tools.checkstyle.AbstractAutomaticBean
configure, contextualize, getConfiguration, setupChild
-
Field Details
-
severity
Specify the severity level of this filter. -
acceptOnMatch
Control whether the filter accepts an audit event if and only if there is a match between the event's severity level and property severity. If acceptOnMatch isfalse, then the filter accepts an audit event if and only if there is not a match between the event's severity level and property severity.
-
-
Constructor Details
-
SeverityMatchFilter
public SeverityMatchFilter()Creates a newSeverityMatchFilterinstance.
-
-
Method Details
-
setSeverity
Setter to specify the severity level of this filter.- Parameters:
severity- The new severity level- Since:
- 3.2
- See Also:
-
setAcceptOnMatch
Setter to control whether the filter accepts an audit event if and only if there is a match between the event's severity level and property severity. If acceptOnMatch isfalse, then the filter accepts an audit event if and only if there is not a match between the event's severity level and property severity.- Parameters:
acceptOnMatch- if true, accept on matches; if false, reject on matches.- Since:
- 3.2
-
finishLocalSetup
Description copied from class:AbstractAutomaticBeanProvides a hook to finish the part of this component's setup that was not handled by the bean introspection.The default implementation does nothing.
- Specified by:
finishLocalSetupin classAbstractAutomaticBean
-
accept
Description copied from interface:FilterDetermines whether or not a filtered AuditEvent is accepted. An accepted event is kept in the final report as a violation; a rejected event is filtered out. In other words, returningtruemakes the violation appear in the report, while returningfalsesuppresses it.
-