use of org.sonarsource.sonarlint.core.analysis.container.analysis.issue.ignore.pattern.IssuePattern in project sonarlint-core by SonarSource.
the class EnforceIssuesFilter method accept.
@Override
public boolean accept(FilterableIssue issue, IssueFilterChain chain) {
var atLeastOneRuleMatched = false;
var atLeastOnePatternFullyMatched = false;
IssuePattern matchingPattern = null;
for (IssuePattern pattern : multicriteriaPatterns) {
if (pattern.matchRule(issue.ruleKey())) {
atLeastOneRuleMatched = true;
var component = ((DefaultFilterableIssue) issue).getComponent();
if (component.isFile()) {
var file = (SonarLintInputFile) component;
if (pattern.matchFile(file.relativePath())) {
atLeastOnePatternFullyMatched = true;
matchingPattern = pattern;
}
}
}
}
if (atLeastOneRuleMatched) {
if (atLeastOnePatternFullyMatched) {
LOG.debug("Issue {} enforced by pattern {}", issue, matchingPattern);
}
return atLeastOnePatternFullyMatched;
} else {
return chain.accept(issue);
}
}
Aggregations