diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2022-06-20 14:54:01 -0500 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-06-21 20:02:45 +0000 |
commit | 4c674a26a6c422348f7a3f3fbfb8712abf001bbd (patch) | |
tree | ac554d55c710c2fbbe154a3f93a87da1f7ae86ac /server/sonar-ce-task-projectanalysis/src | |
parent | 2cb3e53879262017a32c3e394ac30669e573c42c (diff) | |
download | sonarqube-4c674a26a6c422348f7a3f3fbfb8712abf001bbd.tar.gz sonarqube-4c674a26a6c422348f7a3f3fbfb8712abf001bbd.zip |
SONAR-16521 'Line Coverage' inconsistent with 'Lines to cover' and 'uncovered lines'
Diffstat (limited to 'server/sonar-ce-task-projectanalysis/src')
2 files changed, 4 insertions, 1 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/CoverageMeasuresStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/CoverageMeasuresStep.java index 2db3a2d6e13..fd9c5ceb783 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/CoverageMeasuresStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/CoverageMeasuresStep.java @@ -112,6 +112,9 @@ public class CoverageMeasuresStep implements ComputationStep { @Override public void visitFile(Component file) { + if (file.getFileAttributes().isUnitTest()) { + return; + } try (CloseableIterator<ScannerReport.LineCoverage> lineCoverage = reportReader.readComponentCoverage(file.getReportAttributes().getRef())) { int linesToCover = 0; int coveredLines = 0; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/NewCoverageMeasuresStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/NewCoverageMeasuresStep.java index 206dfc91ed8..ae5eb75170c 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/NewCoverageMeasuresStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/NewCoverageMeasuresStep.java @@ -199,7 +199,7 @@ public class NewCoverageMeasuresStep implements ComputationStep { @Override public void initialize(CounterInitializationContext context) { Component component = context.getLeaf(); - if (component.getType() != Component.Type.FILE) { + if (component.getType() != Component.Type.FILE || component.getFileAttributes().isUnitTest()) { return; } Optional<Set<Integer>> newLinesSet = newLinesRepository.getNewLines(component); |