Class SuppressWithNearbyCommentFilter.Tag
java.lang.Object
com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyCommentFilter.Tag
- Enclosing class:
SuppressWithNearbyCommentFilter
A Tag holds a suppression comment and its location.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intThe first line where warnings may be suppressed.private final intThe last line where warnings may be suppressed.private final PatternThe parsed check regexp, expanded for the text of this tag.private final PatternThe parsed check ID regexp, expanded for the text of this tag.private final PatternThe parsed message regexp, expanded for the text of this tag.private final StringThe text of the tag. -
Constructor Summary
ConstructorsConstructorDescriptionTag(String text, int line, SuppressWithNearbyCommentFilter filter) Constructs a tag. -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()private booleanisCheckMatch(TreeWalkerAuditEvent event) Checks whetherTreeWalkerAuditEventsource name matches the check format.private booleanisIdMatch(TreeWalkerAuditEvent event) Checks whether theTreeWalkerAuditEventmodule ID matches the ID format.private booleanChecks whether theTreeWalkerAuditEventis in the scope of the suppression.booleanisMatch(TreeWalkerAuditEvent event) Determines whether the source of an audit event matches the text of this tag.private booleanChecks whether theTreeWalkerAuditEventmessage matches the message format.private static intparseInfluence(String format, String influenceFormat, String text) Gets influence from suppress filter influence format param.toString()
-
Field Details
-
text
The text of the tag. -
firstLine
private final int firstLineThe first line where warnings may be suppressed. -
lastLine
private final int lastLineThe last line where warnings may be suppressed. -
tagCheckRegexp
The parsed check regexp, expanded for the text of this tag. -
tagMessageRegexp
The parsed message regexp, expanded for the text of this tag. -
tagIdRegexp
The parsed check ID regexp, expanded for the text of this tag.
-
-
Constructor Details
-
Tag
Tag(String text, int line, SuppressWithNearbyCommentFilter filter) Constructs a tag.- Parameters:
text- the text of the suppression.line- the line number.filter- theSuppressWithNearbyCommentFilterwith the context- Throws:
IllegalArgumentException- if unable to parse expanded text.
-
-
Method Details
-
parseInfluence
Gets influence from suppress filter influence format param.- Parameters:
format- influence format to parseinfluenceFormat- raw influence formattext- text of the suppression- Returns:
- parsed influence
- Throws:
IllegalArgumentException- when unable to parse int in format
-
equals
-
hashCode
public int hashCode() -
isMatch
Determines whether the source of an audit event matches the text of this tag.- Parameters:
event- theTreeWalkerAuditEventto check.- Returns:
- true if the source of event matches the text of this tag.
-
isInScopeOfSuppression
Checks whether theTreeWalkerAuditEventis in the scope of the suppression.- Parameters:
event-TreeWalkerAuditEventinstance.- Returns:
- true if the
TreeWalkerAuditEventis in the scope of the suppression.
-
isCheckMatch
Checks whetherTreeWalkerAuditEventsource name matches the check format.- Parameters:
event-TreeWalkerAuditEventinstance.- Returns:
- true if the
TreeWalkerAuditEventsource name matches the check format.
-
isIdMatch
Checks whether theTreeWalkerAuditEventmodule ID matches the ID format.- Parameters:
event-TreeWalkerAuditEventinstance.- Returns:
- true if the
TreeWalkerAuditEventmodule ID matches the ID format.
-
isMessageMatch
Checks whether theTreeWalkerAuditEventmessage matches the message format.- Parameters:
event-TreeWalkerAuditEventinstance.- Returns:
- true if the
TreeWalkerAuditEventmessage matches the message format.
-
toString
-