diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2015-02-19 14:46:17 +0100 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2015-02-19 15:09:29 +0100 |
commit | 91154a424d84bcc708cd95d18e86f582f218cd18 (patch) | |
tree | 069f5b1d46e1bcf46982446807b0e8cf14723594 /sonar-batch | |
parent | 97b75e446c28d8c90b7c42575b54ceb233ac7920 (diff) | |
download | sonarqube-91154a424d84bcc708cd95d18e86f582f218cd18.tar.gz sonarqube-91154a424d84bcc708cd95d18e86f582f218cd18.zip |
SONAR-5772 Force coverage measure computation by default
Diffstat (limited to 'sonar-batch')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/source/LinesSensor.java | 6 | ||||
-rw-r--r-- | sonar-batch/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/source/LinesSensor.java b/sonar-batch/src/main/java/org/sonar/batch/source/LinesSensor.java index b2f159d0997..aac994e30d4 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/source/LinesSensor.java +++ b/sonar-batch/src/main/java/org/sonar/batch/source/LinesSensor.java @@ -64,6 +64,12 @@ public final class LinesSensor implements Sensor { .forMetric(CoreMetrics.NCLOC) .withValue(metadata.nonBlankLines())) .save(); + // No test and no coverage on those files + ((DefaultMeasure<Integer>) context.<Integer>newMeasure() + .onFile(f) + .forMetric(CoreMetrics.LINES_TO_COVER) + .withValue(0)) + .save(); } } } diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java index 6656f5dd7c7..49905eace3b 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java @@ -127,8 +127,8 @@ public class MeasuresMediumTest { .build()) .start(); - // QP + 2 x lines + 1 x ncloc - assertThat(result.measures()).hasSize(4); + // QP + 2 x lines + 1 x ncloc+ 1 x lines_to_cover + assertThat(result.measures()).hasSize(5); assertThat(result.measures()).contains(new DefaultMeasure<Integer>() .forMetric(CoreMetrics.LINES) |