Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Conversation

anlambert
Copy link
Contributor

@anlambert anlambert commented Jan 24, 2023

When a coverage node has been created from a cobertura report, the mergePath method was returning a wrong path if the provided local path contains any subpaths in it. Those subpaths were prepended to the local path thus doubling them in the merged path (for instance "a/b/c" was transformed to "a/b/a/b/c").

As a consequence, FileCoverageNode.getPath was returning a wrong file path which prevented any source file painting and display in the Jenkins UI.

Fixes #456.

For the record, I deployed that fix to the Jenkins instance we are using in our development team and source file coverage display is now working when using cobertura reports.

The fix seems pretty harmless to me, surely not the best one but I guess other users of the plugin encountering the same bug will be happy to have the display of coverage painting on source files back as it is quite frustrating to not have it.

@codecov
Copy link

codecov bot commented Jan 24, 2023

Codecov Report

Merging #547 (c981227) into master (4037834) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master     #547      +/-   ##
============================================
+ Coverage     72.80%   72.83%   +0.03%     
- Complexity     1028     1031       +3     
============================================
  Files            88       88              
  Lines          3824     3825       +1     
  Branches        440      440              
============================================
+ Hits           2784     2786       +2     
+ Misses          893      892       -1     
  Partials        147      147              
Impacted Files Coverage Δ
...o/jenkins/plugins/coverage/model/CoverageNode.java 94.11% <100.00%> (+0.02%) ⬆️
...ns/coverage/adapter/parser/JavaCoverageParser.java 83.33% <0.00%> (+1.28%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@anlambert anlambert force-pushed the coverage-node-fix-mergepath-for-cobertura branch from 0ee3359 to 3b5fe79 Compare January 24, 2023 16:28
When a coverage node has been created from a cobertura report, the mergePath
method was returning a wrong path if the provided local path contains any
subpaths in it. Those subpaths were prepended to the local path thus doubling
them in the merged path (for instance "a/b/c" was transformed to "a/b/a/b/c").

As a consequence, FileCoverageNode.getPath was returning a wrong file path which
prevented any source file painting and display in the Jenkins UI.

Fix #456
@anlambert anlambert force-pushed the coverage-node-fix-mergepath-for-cobertura branch from 3b5fe79 to c981227 Compare January 24, 2023 18:44
@uhafner uhafner added the bug Bugs or performance problems label Jan 25, 2023
@uhafner
Copy link
Member

uhafner commented Jan 25, 2023

Thanks for fixing!

@uhafner
Copy link
Member

uhafner commented Jan 26, 2023

I also integrated your changes into https://github.com/uhafner/coverage-model/pull/63. The next version of the coverage plugin will use this model to parse all files.

@uhafner uhafner merged commit 739f31f into jenkinsci:master Jan 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Bugs or performance problems

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cobertura report parser doesn't copy source files due to doubled path

2 participants