diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2015-11-17 11:35:28 +0100 |
---|---|---|
committer | Duarte Meneses <duarte.meneses@sonarsource.com> | 2015-11-18 17:20:42 +0100 |
commit | 6c30b79fcdb15e16c440976f47b4f5725f45a91f (patch) | |
tree | b847a78b02ced5fc595bdddb41e518b1bb68a2ef /it | |
parent | 2d74e2414836ee0b9c8db3e3239dece7ff7c7af6 (diff) | |
download | sonarqube-6c30b79fcdb15e16c440976f47b4f5725f45a91f.tar.gz sonarqube-6c30b79fcdb15e16c440976f47b4f5725f45a91f.zip |
SONAR-6752 Deprecate org.sonar.batch.issue.IssueFilters extension point and add new one
Diffstat (limited to 'it')
-rw-r--r-- | it/it-plugins/issue-filter-plugin/src/main/java/IssueFilterBeforeLine5.java | 15 | ||||
-rw-r--r-- | it/it-plugins/issue-filter-plugin/src/main/java/ModuleIssueFilter.java | 16 |
2 files changed, 23 insertions, 8 deletions
diff --git a/it/it-plugins/issue-filter-plugin/src/main/java/IssueFilterBeforeLine5.java b/it/it-plugins/issue-filter-plugin/src/main/java/IssueFilterBeforeLine5.java index aaea16c5b69..3e6975b9208 100644 --- a/it/it-plugins/issue-filter-plugin/src/main/java/IssueFilterBeforeLine5.java +++ b/it/it-plugins/issue-filter-plugin/src/main/java/IssueFilterBeforeLine5.java @@ -1,6 +1,8 @@ +import org.sonar.api.scan.issue.filter.IssueFilterChain; + +import org.sonar.api.scan.issue.filter.FilterableIssue; import org.sonar.api.config.Settings; -import org.sonar.api.issue.Issue; -import org.sonar.api.issue.IssueFilter; +import org.sonar.api.scan.issue.filter.IssueFilter; /** * This filter removes the issues that are on line < 5 @@ -16,7 +18,7 @@ public class IssueFilterBeforeLine5 implements IssueFilter { } @Override - public boolean accept(Issue issue) { + public boolean accept(FilterableIssue issue, IssueFilterChain chain) { if (issue.componentKey() == null) { throw new IllegalStateException("Issue component is not set"); } @@ -24,6 +26,11 @@ public class IssueFilterBeforeLine5 implements IssueFilter { throw new IllegalStateException("Issue rule is not set"); } - return !settings.getBoolean("enableIssueFilters") || issue.line() == null || issue.line() >= 5; + boolean b = !settings.getBoolean("enableIssueFilters") || issue.line() == null || issue.line() >= 5; + if (!b) { + return false; + } + + return chain.accept(issue); } } diff --git a/it/it-plugins/issue-filter-plugin/src/main/java/ModuleIssueFilter.java b/it/it-plugins/issue-filter-plugin/src/main/java/ModuleIssueFilter.java index de0de20cf32..ed5e9cbaf4f 100644 --- a/it/it-plugins/issue-filter-plugin/src/main/java/ModuleIssueFilter.java +++ b/it/it-plugins/issue-filter-plugin/src/main/java/ModuleIssueFilter.java @@ -1,6 +1,8 @@ +import org.sonar.api.scan.issue.filter.FilterableIssue; + +import org.sonar.api.scan.issue.filter.IssueFilterChain; import org.sonar.api.config.Settings; -import org.sonar.api.issue.Issue; -import org.sonar.api.issue.IssueFilter; +import org.sonar.api.scan.issue.filter.IssueFilter; import org.sonar.api.rule.RuleKey; /** @@ -19,7 +21,7 @@ public class ModuleIssueFilter implements IssueFilter { } @Override - public boolean accept(Issue issue) { + public boolean accept(FilterableIssue issue, IssueFilterChain chain) { if (issue.componentKey() == null) { throw new IllegalStateException("Issue component is not set"); } @@ -27,6 +29,12 @@ public class ModuleIssueFilter implements IssueFilter { throw new IllegalStateException("Issue rule is not set"); } - return !settings.getBoolean("enableIssueFilters") || !ONE_ISSUE_PER_MODULE_RULEKEY.equals(issue.ruleKey()); + boolean b = !settings.getBoolean("enableIssueFilters") || !ONE_ISSUE_PER_MODULE_RULEKEY.equals(issue.ruleKey()); + + if (!b) { + return false; + } + + return chain.accept(issue); } } |