Skip to content

Commit

Permalink
Update CoverageRecorder.java
Browse files Browse the repository at this point in the history
Process the file nodes using a single pass
  • Loading branch information
GoodOwl authored Dec 10, 2024
1 parent f02ce61 commit c8c0269
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,13 @@ private void resolveAbsolutePaths(final Node rootNode, final FilePath workspace,
if (!pathMapping.isEmpty()) {
log.logInfo("Making paths of " + pathMapping.size() + " source code files relative to workspace root...");
var builder = new TreeStringBuilder();
rootNode.getAllFileNodes().stream()
.filter(file -> pathMapping.containsKey(file.getRelativePath()))
.forEach(file -> file.setRelativePath(builder.intern(pathMapping.get(file.getRelativePath()))));
rootNode.getAllFileNodes().forEach(file -> {
String newPath = pathMapping.get(file.getRelativePath());
if (newPath != null) {

Check warning on line 450 in plugin/src/main/java/io/jenkins/plugins/coverage/metrics/steps/CoverageRecorder.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 450 is only partially covered, one branch is missing
file.setRelativePath(builder.intern(newPath));
}
});

builder.dedup();
}
}
Expand Down

0 comments on commit c8c0269

Please sign in to comment.