aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/source/LinesSensor.java6
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java4
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)