diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2016-03-29 18:13:12 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2016-03-30 11:32:39 +0200 |
commit | 946a448c08ccc10ad1c0af778ae5d9f179655ef8 (patch) | |
tree | 14acab59210015b9a2e3aeba04a7b54bcfa5fc19 /sonar-scanner-engine/src/main/java/org | |
parent | 2cf5d0f82c96846af16007233b674e0e5c638eea (diff) | |
download | sonarqube-946a448c08ccc10ad1c0af778ae5d9f179655ef8.tar.gz sonarqube-946a448c08ccc10ad1c0af778ae5d9f179655ef8.zip |
SONAR-7497 Restore behavior for line coverage after move to proto3
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org')
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/batch/report/CoveragePublisher.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/report/CoveragePublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/report/CoveragePublisher.java index 1d8d5fee448..1ed96d1ceb7 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/batch/report/CoveragePublisher.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/batch/report/CoveragePublisher.java @@ -62,25 +62,35 @@ public class CoveragePublisher implements ReportPublisherStep { builder.setUtHits(Integer.parseInt(value) > 0); } }); - applyLineMeasure(resource.key(), lineCount, CoreMetrics.CONDITIONS_BY_LINE_KEY, coveragePerLine, + applyLineMeasure(resource.key(), lineCount, CoreMetrics.IT_COVERAGE_LINE_HITS_DATA_KEY, coveragePerLine, + new MeasureOperation() { + @Override + public void apply(String value, LineCoverage.Builder builder) { + builder.setItHits(Integer.parseInt(value) > 0); + } + }); + // Just in case we have only IT and no UT, we first take conditions from ITs, then from UTs (UTs will override ITs). + // Note that it would be very strange (and unsupported in scanner report) to have ITs and UTs don't report the same number of + // conditions. Not even talking about overall conditions... + applyLineMeasure(resource.key(), lineCount, CoreMetrics.IT_CONDITIONS_BY_LINE_KEY, coveragePerLine, new MeasureOperation() { @Override public void apply(String value, LineCoverage.Builder builder) { builder.setConditions(Integer.parseInt(value)); } }); - applyLineMeasure(resource.key(), lineCount, CoreMetrics.COVERED_CONDITIONS_BY_LINE_KEY, coveragePerLine, + applyLineMeasure(resource.key(), lineCount, CoreMetrics.CONDITIONS_BY_LINE_KEY, coveragePerLine, new MeasureOperation() { @Override public void apply(String value, LineCoverage.Builder builder) { - builder.setUtCoveredConditions(Integer.parseInt(value)); + builder.setConditions(Integer.parseInt(value)); } }); - applyLineMeasure(resource.key(), lineCount, CoreMetrics.IT_COVERAGE_LINE_HITS_DATA_KEY, coveragePerLine, + applyLineMeasure(resource.key(), lineCount, CoreMetrics.COVERED_CONDITIONS_BY_LINE_KEY, coveragePerLine, new MeasureOperation() { @Override public void apply(String value, LineCoverage.Builder builder) { - builder.setItHits(Integer.parseInt(value) > 0); + builder.setUtCoveredConditions(Integer.parseInt(value)); } }); applyLineMeasure(resource.key(), lineCount, CoreMetrics.IT_COVERED_CONDITIONS_BY_LINE_KEY, coveragePerLine, |