]> source.dussan.org Git - sonarqube.git/commitdiff
LCOM4 must not be 1 when bytecode is not available
authorsimonbrandhof <simon.brandhof@gmail.com>
Fri, 11 Feb 2011 14:02:55 +0000 (15:02 +0100)
committersimonbrandhof <simon.brandhof@gmail.com>
Fri, 11 Feb 2011 14:02:55 +0000 (15:02 +0100)
plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/ChidamberKemererBridge.java

index 4b09d64d2c637459379c65d75f88aadc2a342647..8a103e593eabf87401d13154bd02c5877d265c66 100644 (file)
@@ -32,12 +32,15 @@ public class ChidamberKemererBridge extends Bridge {
     super(true);
   }
 
-
   @Override
   public final void onFile(SourceFile squidFile, Resource sonarFile) {
     context.saveMeasure(sonarFile, CoreMetrics.DEPTH_IN_TREE, squidFile.getDouble(Metric.DIT));
     context.saveMeasure(sonarFile, CoreMetrics.NUMBER_OF_CHILDREN, squidFile.getDouble(Metric.NOC));
     context.saveMeasure(sonarFile, CoreMetrics.RFC, squidFile.getDouble(Metric.RFC));
-    context.saveMeasure(sonarFile, CoreMetrics.LCOM4, squidFile.getDouble(Metric.LCOM4));
+
+    double lcom4 = squidFile.getDouble(Metric.LCOM4);
+    if (lcom4>0.0) {
+      context.saveMeasure(sonarFile, CoreMetrics.LCOM4, lcom4);
+    }
   }
 }