From 12b3f014ce875093ed513900e7f7bc4c9997c5cc Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Wed, 17 Apr 2013 11:06:46 +0200 Subject: [PATCH] Fix issue when violations are ignored --- .../java/org/sonar/batch/index/DefaultIndex.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java index ea0746d6b47..8f37854061f 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java @@ -367,14 +367,15 @@ public class DefaultIndex extends SonarIndex { } violation.setResource(bucket.getResource()); - addViolation(violation, bucket, force); - deprecatedViolations.add(violation); + if (addViolation(violation, bucket, force)){ + deprecatedViolations.add(violation); + } } - private void addViolation(Violation violation, Bucket bucket, boolean force) { + private boolean addViolation(Violation violation, Bucket bucket, boolean force) { boolean isIgnored = !force && violationFilters != null && violationFilters.isIgnored(violation); if (isIgnored) { - return; + return false; } // TODO this code is not the responsibility of this index. It should be moved somewhere else. @@ -386,13 +387,15 @@ public class DefaultIndex extends SonarIndex { violation.setSeverity(violation.getRule().getSeverity()); } else { LoggerFactory.getLogger(getClass()).debug("Rule is not activated, ignoring violation {}", violation); - return; + return false; } } bucket.addViolation(violation); + return true; } + // // // -- 2.39.5