I think this is the issue:

The health score is calculated in this file:
junit-plugin / src / main / java / hudson / tasks / test / AbstractTestResultAction.java

On Line 160-162, the health score is calculated. The lines are shown below:

int score = (totalCount == 0)
? 100
: (int) (100.0 * Math.max(1.0, Math.min(0.0, 1.0 - (scaleFactor * failCount) / totalCount)));

The problem is the Math.max has a first argument of 1.0, which makes the second argument irrelevant as it is always less than 1. The first argument should be 0.0, as the intention is to never report negative health.

Corrected code is below (just changed to 1.0 to 0.0 in the first arg of Math.max:

int score = (totalCount == 0)
? 100
: (int) (100.0 * Math.max(0.0, Math.min(0.0, 1.0 - (scaleFactor * failCount) / totalCount)));

I'm pretty sure the above would fix the problem. This nested max, min functions seem redundant so the code could be further simplified - I think the following is more concise:

int score = (totalCount == 0)
? 100
: (int) (100.0 * Math.max(0.0, 1.0 - (scaleFactor * failCount) / totalCount));

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to