Ognjen Bubalo
added a comment - 2013-03-04 17:19 Hi,
I think we discussed this in this issue: https://issues.jenkins-ci.org/browse/JENKINS-16946
As I see it is alright except the alignment of the bars and when the Missed>Covered issue occurs, but this is not what I see on the picture.
Cheers,
Ogi

Marcel L
added a comment - 2013-03-04 18:22 Hi Ogi,
could you the explain me the 2nd row ? In the first col I'say the ratio red/green is ~75/25 but it says 58%.
2nd row 2nd col is more obvious. It says 55 %, bute the red bar has 80% or 90% red.
Cheers,
Marcel

The bar-s length is not connected to the coverage percent. The bar starts from the left. So if we check the second row second column:
The percent is 55% because (366/(366+298))*100. If 366 is the maximum length than the 298/366 is the red bar's length and 366 is the green bar's. The maximum length depends on other rows in that column. So lets say C: 366 is the biggest number of covered (I see only 2 rows), so other rows in that particular column have to be shorter. This is because we want to compare object's coverage with other objects. Check the 1st row. It is way shorter because it has only C:48.

Ognjen Bubalo
added a comment - 2013-03-04 23:55 Hi Marcel,
The bar-s length is not connected to the coverage percent. The bar starts from the left. So if we check the second row second column:
The percent is 55% because (366/(366+298))*100. If 366 is the maximum length than the 298/366 is the red bar's length and 366 is the green bar's. The maximum length depends on other rows in that column. So lets say C: 366 is the biggest number of covered (I see only 2 rows), so other rows in that particular column have to be shorter. This is because we want to compare object's coverage with other objects. Check the 1st row. It is way shorter because it has only C:48.
Cheers,
Ogi

I understand the length of the bars depend the max coverages of each column. Ok that's fine.

Nevertheless the ratio of each red/green bar should represent the calculated percentage of the cell.

If you simply look at the 2nd row 2nd col, you could think. low coverage ,Close to 10%. But the percentage number gives you 55%.
This is non intuitive and wrong in my opinion. I'm not talking about the length of each red/green bar it's just about the ration red/green

Marcel L
added a comment - 2013-03-05 22:22 Hi Ogi,
I understand the length of the bars depend the max coverages of each column. Ok that's fine.
Nevertheless the ratio of each red/green bar should represent the calculated percentage of the cell.
If you simply look at the 2nd row 2nd col, you could think. low coverage ,Close to 10%. But the percentage number gives you 55%.
This is non intuitive and wrong in my opinion. I'm not talking about the length of each red/green bar it's just about the ration red/green

"Nevertheless the ratio of each red/green bar should represent the calculated percentage of the cell."
No because the percentage does not tell us too much, but the length of missed and covered objects does.

Ognjen Bubalo
added a comment - 2013-03-06 08:43 Hi,
"Nevertheless the ratio of each red/green bar should represent the calculated percentage of the cell."
No because the percentage does not tell us too much, but the length of missed and covered objects does.
Check Marc's response in this thread: https://groups.google.com/d/msg/jenkins-jacoco-plugin-mailing-list/9pJCQpjEOck/X7Zo-MoLEw0J
Cheers,
Ogi

well the percentage does tell me something very important.
The percentage tells me I have 55% covered. Not more and not less. But If the graphical representation shows me 90% uncovered it's just wrong. And if the graphical respresentation of the percentage is wrong I don't see why I should use it.

I got Marc's and your point. The total length of the red/green bar gives me further informations. Comparing percentage between projects is not of much use. But I don't wan't to do that here.

I would like to use the red/green bar to quickly spot areas which should be improved.

Marcel L
added a comment - 2013-03-06 19:35 Hi Ogi,
well the percentage does tell me something very important.
The percentage tells me I have 55% covered. Not more and not less. But If the graphical representation shows me 90% uncovered it's just wrong. And if the graphical respresentation of the percentage is wrong I don't see why I should use it.
I got Marc's and your point. The total length of the red/green bar gives me further informations. Comparing percentage between projects is not of much use. But I don't wan't to do that here.
I would like to use the red/green bar to quickly spot areas which should be improved.

I think the best solution would be to add an option for the plugin to set the graphical representation length of uncovered lines / covered lines.
By default we would keep this representation, and another option would be to set the length of graphical representation of M/C lines according to the M/(M+C) and C/(M+C) percentage.

Laurent Schoelens
added a comment - 2013-03-26 08:55 Hello everyone,
I think the best solution would be to add an option for the plugin to set the graphical representation length of uncovered lines / covered lines.
By default we would keep this representation, and another option would be to set the length of graphical representation of M/C lines according to the M/(M+C) and C/(M+C) percentage.
Greetings,
Laurent

Marcus Bauer
added a comment - 2013-09-16 12:34 The representation is actually wrong, as the red bar had a size depending on Missed/Covered for percentages > 50%.
To pick up the previous example of 366 covered/298 missed, the length of the green bar should be 366+298 and 298 the red bar's length – relative to 100%.
The 100%-value should be based on the maximum covered+missed, not the maximum covered (or, maximum missed).
https://github.com/jenkinsci/jacoco-plugin/pull/30

Guido Grazioli
added a comment - 2013-10-06 02:40 My 2c: the report should reflect the same graphical representation generated by the jacoco site report, to avoid confusion.
https://github.com/jenkinsci/jacoco-plugin/pull/33

SCM/JIRA link daemon
added a comment - 2013-11-03 18:54 Code changed in jenkins
User: Marcus Bauer
Path:
src/main/java/hudson/plugins/jacoco/model/Coverage.java
src/main/java/hudson/plugins/jacoco/model/CoverageObject.java
http://jenkins-ci.org/commit/jacoco-plugin/571045f9f4a2eaabc83ee4009352f77bc0de05d9
Log:
JENKINS-17027 Red/green ratio is wrong
This issue is adressed by taking the total number of lines, etc. into account – instead of only the covered or missing items (depends on whether you have 50% coverage or more)

SCM/JIRA link daemon
added a comment - 2017-03-23 20:09 Code changed in jenkins
User: Marcus Bauer
Path:
src/main/java/hudson/plugins/jacoco/model/Coverage.java
src/main/java/hudson/plugins/jacoco/model/CoverageObject.java
http://jenkins-ci.org/commit/jacoco-plugin/6adf351a1cef5438d98bf49d4dbc1c45a4b5ec1c
Log:
JENKINS-17027 Red/green ratio is wrong
This issue is adressed by taking the total number of lines, etc. into account – instead of only the covered or missing items (depends on whether you have 50% coverage or more)