use of org.sonar.scanner.protocol.output.ScannerReport.LineCoverage.Builder in project sonarqube by SonarSource.
the class CoveragePublisher method publish.
@Override
public void publish(ScannerReportWriter writer) {
for (final DefaultInputFile inputFile : componentStore.allFilesToPublish()) {
Map<Integer, LineCoverage.Builder> coveragePerLine = new LinkedHashMap<>();
int lineCount = inputFile.lines();
applyLineMeasure(inputFile.key(), lineCount, CoreMetrics.COVERAGE_LINE_HITS_DATA_KEY, coveragePerLine, (value, builder) -> builder.setHits(Integer.parseInt(value) > 0));
applyLineMeasure(inputFile.key(), lineCount, CoreMetrics.CONDITIONS_BY_LINE_KEY, coveragePerLine, (value, builder) -> builder.setConditions(Integer.parseInt(value)));
applyLineMeasure(inputFile.key(), lineCount, CoreMetrics.COVERED_CONDITIONS_BY_LINE_KEY, coveragePerLine, (value, builder) -> builder.setCoveredConditions(Integer.parseInt(value)));
writer.writeComponentCoverage(inputFile.batchId(), Iterables.transform(coveragePerLine.values(), BuildCoverage.INSTANCE));
}
}
Aggregations