-
Notifications
You must be signed in to change notification settings - Fork 283
Legend in html is wrong if threshold options are 0% or 100% #369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statemen 8000 t. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Not needed anymore since #367 is merged one hour ago. :-) |
Checked the test data and saw that the legend is changed only. |
The current template includes this code: <span class="coverage-low">low: < {{COVERAGE_MED}} %</span>
{% if COVERAGE_MED != COVERAGE_HIGH %}
<span class="coverage-medium">medium: >= {{COVERAGE_MED}} %</span>
{% endif %}
<span class="coverage-high">high: >= {{COVERAGE_HIGH}} %</span> What specifically do you propose as an alternative? If I understand correctly the low-coverage should check zero: {% if COVERAGE_MED == 0 %}
<span class="coverage-low">low: = 0 %</span>
{% else %}
<span class="coverage-low">low: < {{COVERAGE_MED}} %</span>
{% endif %} And the high coverage should check against 100: {% if COVERAGE_HIGH < 100 %}
<span class="coverage-high">high: >= {{COVERAGE_HIGH}} %</span>
{% else %}
<span class="coverage-high">high: = 100 %</span>
{% endif %} Right? Or did I misunderstand? |
That's correct. I'm working on a PR for this. |
After adding tests I think it should be:
Because the medium value is part of the mid range. |
That sounds reasonable, but the legend must match the actual code in the Lines 77 to 86 in 1f17d44
(coverage-none and coverage-low are effectively the same, could be unified/removed though) |
Add feature suggested in issue gcovr#369
So, the condition |
And alos the |
I'm not sure what would be correct. These are edge cases. We can define them in any way, but should choose that way that looks like the best user experience. If medium coverage is zero, then arguably medium coverage just means low coverage. Perhaps we should just borrow the semantics from the HTML5
Perhaps we should then deprecate I think the logic as it is is reasonable and that only the legend should be updated to reflect it correctly. Thus, the legend would always show an entry for low coverage. But I'm willing to be convinced otherwise. |
I'm also not sure.
But it is a little bit wired if you only want to have low and high: <!DOCTYPE html>
<html>
<body>
Optimum 99 (current value):
<meter min="0" max="100" low="90" high="90" optimum="99" value="89" title="%">89</meter>
<meter min="0" max="100" low="90" high="90" optimum="99" value="90" title="%">90</meter>
<meter min="0" max="100" low="90" high="90" optimum="99" value="91" title="%">91</meter>
<hr/>
Optimum egual to low/high:
<meter min="0" max="100" low="90" high="90" optimum="90" value="89" title="%">89</meter>
<meter min="0" max="100" low="90" high="90" optimum="90" value="90" title="%">90</meter>
<meter min="0" max="100" low="90" high="90" optimum="90" value="91" title="%">91</meter>
<hr/>
</body>
</html> If the What about adding a new option |
Upon reading the HTML standards more closely, it seems entirely unspecified what low and high actually mean.
Well spotted, we should probably correct that. We were probably worri 8000 ed that optimum=max would break something.
This sounds complicated, and I don't want unnecessary complexity. Either we imitate Of the two variants, I find the current gcovr behaviour more intuitive. As a user story:
If a user has other expectations things get ugly, but this is unavoidable. For example:
This boils down to which relations (less than, at most, at least, more than, …) we expect. But for purposes like quality-gating I expect an inclusive lower bound for medium and high coverage regions, which means an exclusive upper bound for low and medium regions. What HTML |
I think that the current legend causes confusion because the medium-threshold is shown twice, in the definition of low and medium. Instead, I now think we should only show the lower bounds:
(giving a lower bound for low is superfluous because it's always zero, but not giving the bound would look odd.) I also think that in this definition, it would be fine if the legend for I'm ambivalent regarding whether cases like high=100 should be special-cased. |
I fully agree.
Current implementation will not print medium if it is equal to high. This is tested with
I've played a little bit with the ranges and saw |
Reply to the meter element and the behaviour: I've played a little bit more with the meter and different browsers and have come to following result for low 80 and high 90:
Result for low 80 and high 80:
You see, the colors depend on the browser and are not reliable. I'll try this localy and let you know about the reult. |
I've updated the template and the test data, in my opinion result looks good. |
- Change legend in html. - --html-medium-threshold must be greater 0.
looks great, let's continue this as a pull request! |
PR #371 |
- Change legend in html. - --html-medium-threshold must be greater 0.
Closed via #371. |
If
--html-high-threshold
is 100% in the html the legend is:high: >= 100%
If
--html-medium-threshold
is 0% in the html the legend is:low: <= 0%
The
=
shall only be printed if threshold isn't 0% or 100%The text was updated successfully, but these errors were encountered: