]> source.dussan.org Git - sonarqube.git/commitdiff
Fix issue when violations are ignored
authorJulien Lancelot <julien.lancelot@gmail.com>
Wed, 17 Apr 2013 09:06:46 +0000 (11:06 +0200)
committerJulien Lancelot <julien.lancelot@gmail.com>
Wed, 17 Apr 2013 09:06:46 +0000 (11:06 +0200)
sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java

index ea0746d6b47f34ff3698e5c344bad1313d8638bd..8f37854061f426a1b3becd5a5daf991031329743 100644 (file)
@@ -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;
   }
 
+
   //
   //
   //