Class SuppressWithNearbyCommentFilter.Tag
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyCommentFilter.Tag
-
- Enclosing class:
- SuppressWithNearbyCommentFilter
private static final class SuppressWithNearbyCommentFilter.Tag extends Object
A Tag holds a suppression comment and its location.
-
-
Field Summary
Fields Modifier and Type Field Description private int
firstLine
The first line where warnings may be suppressed.private int
lastLine
The last line where warnings may be suppressed.private Pattern
tagCheckRegexp
The parsed check regexp, expanded for the text of this tag.private Pattern
tagIdRegexp
The parsed check ID regexp, expanded for the text of this tag.private Pattern
tagMessageRegexp
The parsed message regexp, expanded for the text of this tag.private String
text
The text of the tag.
-
Constructor Summary
Constructors Modifier Constructor Description private
Tag(String text, int line, SuppressWithNearbyCommentFilter filter)
Constructs a tag.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
int
hashCode()
private boolean
isCheckMatch(TreeWalkerAuditEvent event)
Checks whetherTreeWalkerAuditEvent
source name matches the check format.private boolean
isIdMatch(TreeWalkerAuditEvent event)
Checks whether theTreeWalkerAuditEvent
module ID matches the ID format.private boolean
isInScopeOfSuppression(TreeWalkerAuditEvent event)
Checks whether theTreeWalkerAuditEvent
is in the scope of the suppression.boolean
isMatch(TreeWalkerAuditEvent event)
Determines whether the source of an audit event matches the text of this tag.private boolean
isMessageMatch(TreeWalkerAuditEvent event)
Checks whether theTreeWalkerAuditEvent
message matches the message format.private static int
parseInfluence(String format, String influenceFormat, String text)
Gets influence from suppress filter influence format param.String
toString()
-
-
-
Field Detail
-
firstLine
private final int firstLine
The first line where warnings may be suppressed.
-
lastLine
private final int lastLine
The last line where warnings may be suppressed.
-
tagCheckRegexp
private final Pattern tagCheckRegexp
The parsed check regexp, expanded for the text of this tag.
-
tagMessageRegexp
private final Pattern tagMessageRegexp
The parsed message regexp, expanded for the text of this tag.
-
tagIdRegexp
private final Pattern tagIdRegexp
The parsed check ID regexp, expanded for the text of this tag.
-
-
Constructor Detail
-
Tag
private Tag(String text, int line, SuppressWithNearbyCommentFilter filter)
Constructs a tag.- Parameters:
text
- the text of the suppression.line
- the line number.filter
- theSuppressWithNearbyCommentFilter
with the context- Throws:
IllegalArgumentException
- if unable to parse expanded text.
-
-
Method Detail
-
parseInfluence
private static int parseInfluence(String format, String influenceFormat, String text)
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
-
isMatch
public boolean isMatch(TreeWalkerAuditEvent event)
Determines whether the source of an audit event matches the text of this tag.- Parameters:
event
- theTreeWalkerAuditEvent
to check.- Returns:
- true if the source of event matches the text of this tag.
-
isInScopeOfSuppression
private boolean isInScopeOfSuppression(TreeWalkerAuditEvent event)
Checks whether theTreeWalkerAuditEvent
is in the scope of the suppression.- Parameters:
event
-TreeWalkerAuditEvent
instance.- Returns:
- true if the
TreeWalkerAuditEvent
is in the scope of the suppression.
-
isCheckMatch
private boolean isCheckMatch(TreeWalkerAuditEvent event)
Checks whetherTreeWalkerAuditEvent
source name matches the check format.- Parameters:
event
-TreeWalkerAuditEvent
instance.- Returns:
- true if the
TreeWalkerAuditEvent
source name matches the check format.
-
isIdMatch
private boolean isIdMatch(TreeWalkerAuditEvent event)
Checks whether theTreeWalkerAuditEvent
module ID matches the ID format.- Parameters:
event
-TreeWalkerAuditEvent
instance.- Returns:
- true if the
TreeWalkerAuditEvent
module ID matches the ID format.
-
isMessageMatch
private boolean isMessageMatch(TreeWalkerAuditEvent event)
Checks whether theTreeWalkerAuditEvent
message matches the message format.- Parameters:
event
-TreeWalkerAuditEvent
instance.- Returns:
- true if the
TreeWalkerAuditEvent
message matches the message format.
-
-