Always round numbers down, never up#146
Open
bquorning wants to merge 4 commits intosimplecov-ruby:mainfrom
Open
Always round numbers down, never up#146bquorning wants to merge 4 commits intosimplecov-ruby:mainfrom
bquorning wants to merge 4 commits intosimplecov-ruby:mainfrom
Conversation
Author
|
cc @amatsuda |
Member
|
@bquorning Could you add a regression test that reproduces the issue? Thanks! |
4f6da24 to
6dbf7be
Compare
Also, consistently render percentages without a space before it. To get some usable data for the test, I copied a number of files from SingleCov's spec/source_file_spec.rb.
759c8c6 to
0dd053c
Compare
When the coverage percentage is rounded up, people may end up misconfiguring SimpleCov with a number that 0.01 too high. They may even think they have a 100% converage, when in fact the coverage is only marginally higher than 99.995%. This commit changes all uses of `#round` for `#floor`, thus always rounding _down_ and never _up_.
I don't think it matters if it's rounded up or down. The point here is that we render it the same way in the header as we do in the table.
c354281 to
7e7bde6
Compare
Author
|
I didn’t find any existing tests in the repo, so I copied a handful of files from simplecov's spec suite to generate some usable coverage numbers to output. The test is currently very long and hard to read, but I’m ready to iterate on that. What is more concerning is that the tests are currently failing on Ruby 2.4 and 2.5. @amatsuda do you know if simplecov-html actually works with those Ruby versions and simplecov v0.18.5? |
|
Is there any chance of this getting merged? 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the coverage percentage is rounded up, people may end up misconfiguring SimpleCov with a number that 0.01 too high. They may even think they have a 100% converage, when in fact the coverage is only marginally higher than 99.995%.
This commit changes all uses of
#roundfor#floor, thus always rounding down and never up.Fixes #130.
May even fix simplecov-ruby/simplecov#948 too.