Skip to content

Commit

Permalink
Merge pull request #292 from GoodOwl/faster-path-resolver
Browse files Browse the repository at this point in the history
Improve performance of relative path mapping
  • Loading branch information
uhafner authored Dec 11, 2024
2 parents 652f519 + ba75ea4 commit 0949826
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 relativePath = file.getRelativePath();
if (pathMapping.containsKey(relativePath)) {

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(pathMapping.get(relativePath)));
}
});

builder.dedup();
}
}
Expand Down

0 comments on commit 0949826

Please sign in to comment.