use of org.sonar.api.batch.sensor.coverage.NewCoverage in project sonarqube by SonarSource.
the class InMemorySensorStorage method store.
@Override
public void store(NewCoverage coverage) {
DefaultCoverage defaultCoverage = (DefaultCoverage) coverage;
String fileKey = defaultCoverage.inputFile().key();
coverageByComponent.computeIfAbsent(fileKey, x -> new ArrayList<>()).add(defaultCoverage);
}
use of org.sonar.api.batch.sensor.coverage.NewCoverage in project sonarqube by SonarSource.
the class ZeroCoverageSensor method storeZeroCoverageForEachExecutableLine.
private static void storeZeroCoverageForEachExecutableLine(final SensorContext context, InputFile f, Set<Integer> executableLines) {
NewCoverage newCoverage = context.newCoverage().onFile(f);
for (Integer lineIdx : executableLines) {
if (lineIdx <= f.lines()) {
newCoverage.lineHits(lineIdx, 0);
}
}
newCoverage.save();
}
Aggregations