jenkinsci / code-coverage-api-plugin

Deprecated Jenkins Code Coverage Plugin
https://plugins.jenkins.io/code-coverage-api/
MIT License
111 stars 77 forks source link

Overall line coverage is 100% but all lines are not covered #711

Open mikkhola opened 1 year ago

mikkhola commented 1 year ago

Jenkins and plugins versions report

Environment Jenkins 2.387.1 Code Coverage API 4.2.2

What Operating System are you using (both controller, and any agents involved in the problem)?

Linux

Reproduction steps

  1. In our case coverage reports covers 31683 lines and there is one uncovered line (overall coverage 99.986%)

Expected Results

Despite the actual coverage being below 100%, the plugin incorrectly rounds it up to 100% in the overall code coverage view. For example, overall code coverage is 99.996% (one line not covered) but the plugin shows overall coverage as 100%. I know it is properly rounded from a math perspective but it should be 100% only if all lines are covered. This can lead to a false sense of code coverage completeness, potentially masking areas that need further testing.

Actual Results

Overall line coverage reported by the plugin is 100%.

Anything else?

No response

stefan6419846 commented 1 year ago

Just for the record: The culprit seems to be https://github.com/jenkinsci/coverage-model/blob/d31981c893fd617a3a59578b3d46d71d11300c76/src/main/java/edu/hm/hafner/coverage/Percentage.java#L129, id est it just is a rendering issue (internally, the precise value is known).