ryanluker / vscode-coverage-gutters

Display test coverage generated by lcov and xml - works with many languages
https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters
MIT License
454 stars 88 forks source link

behavior change suggestion/rfc: statusbar should report `Math.floor` instead of `Math.round` #423

Closed guppy0130 closed 10 months ago

guppy0130 commented 10 months ago

Is your feature request related to a problem? Please describe.

I open a file with 200 LoC, 1 line uncovered. I expect the summary to not say "100% Coverage," since there's a line missing.

It currently does say 100% though, because $\frac{199}{200} * 100=99.5$, and that rounds to $100$.

Describe the solution you'd like

If there's interest/folks are okay with it, I think this line:

https://github.com/ryanluker/vscode-coverage-gutters/blob/7b40ddc682dd3d841bf0f14170854ec037992dab/src/coverage-system/coverageservice.ts#L178

should be changed from Math.round to Math.floor. I'll file a PR for this later today, but wanted to raise the issue too for visibility

Describe alternatives you've considered

Additional context

N/A

ryanluker commented 10 months ago

@guppy0130 Thanks for the ticket and the PR! Logic + math looks good to me, I will take at a look at the PR today.