diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-04-17 11:06:46 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-04-17 11:06:46 +0200 |
commit | 12b3f014ce875093ed513900e7f7bc4c9997c5cc (patch) | |
tree | dba77fc263b8cf48022a376b866b1b17a556b215 | |
parent | 9a9ff68b3b5bfc5479010d6c41a8a0f80fefadd4 (diff) | |
download | sonarqube-12b3f014ce875093ed513900e7f7bc4c9997c5cc.tar.gz sonarqube-12b3f014ce875093ed513900e7f7bc4c9997c5cc.zip |
Fix issue when violations are ignored
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java | 13 |
1 files 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; } + // // // |