Coverage percentages can be floored one hundredth too low

Open Beginner friendly
#98 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
testing-qa

Research direction

Start by reading effective_coverage.floor_two_decimals and trace how it receives covered and total line counts. Check the tests for raw and effective percentage calculations, then add a case for 29 of 10,000 lines. Done when percentages in the report, summary, HTML index, and effective gate use the exact floored value.

Written by the indexing model from the issue text.

Description

bug

Found while reviewing the user manual against the implementation at fe013fe.

effective_coverage.floor_two_decimals computes math.floor(value * 100.0) / 100.0 on a float. For some exact ratios the binary representation is slightly below the decimal value, and the result is one hundredth too low.

Reproduction
>>> import math
>>> math.floor(100.0 * 29 / 10000 * 100.0) / 100.0
0.28

29 of 10,000 lines is exactly 0.29 %.

Effect

Raw and effective percentages in report.json, the summary and the HTML index can be 0.01 lower than the exact value. Together with #17 this also affects the effective gate. The error is towards under-reporting.

Expected behavior

Floor with integer arithmetic on covered and total counts, for example (10000 * covered // total) / 100.

Dominant language
Python
Stars
0
Forks
4
Avg merge
1d 16h
Merged PRs (30d)
16

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from eclipse-score/coverage_tool

All issues in eclipse-score/coverage_tool

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.