Skip to content
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 statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve clarity of line and branch coverage format. #125

Merged
merged 1 commit into from
Sep 2, 2024

Conversation

joshuapinter
Copy link
Contributor

@joshuapinter joshuapinter commented Oct 30, 2023

  • Put percentage first and then covered and total counts in brackets afterwards. Percentage is most critical at a quick glance.

  • Put line and brnach coverage on separate lines.

Before

Coverage report generated for (1/10), (10/10), (2/10), (3/10), (4/10), (5/10), (6/10), (7/10), (8/10), (9/10) to /Users/me/Development/cntral/coverage. 8534 / 16083 LOC (53.06%) covered. 2225 / 4749 branches (46.85%) covered.

After

Now it shows in a clean format, including covered branches, total branches and percent of covered branches. Something like this:

Coverage report generated for (1/10), (10/10), (2/10), (3/10), (4/10), (5/10), (6/10), (7/10), (8/10), (9/10) to /Users/me/Development/cntral/coverage.
Line Coverage: 53.06% (8534 / 16083)
Branch Coverage: 46.85% (2225 / 4749)

When branch coverage is not enabled it simply omits that line, so it appears like this:

Coverage report generated for (1/10), (10/10), (2/10), (3/10), (4/10), (5/10), (6/10), (7/10), (8/10), (9/10) to /Users/me/Development/cntral/coverage.
Line Coverage: 53.06% (8534 / 16083)

- Put percentage first and then covered and total counts in brackets afterwards. Percentage is most critical at a quick glance.

- Put line and brnach coverage on separate lines.

Now it shows in a clean format, including covered branches, total branches and percent of covered branches. Something like this:

```
Coverage report generated for (1/10), (10/10), (2/10), (3/10), (4/10), (5/10), (6/10), (7/10), (8/10), (9/10) to /Users/me/Development/cntral/coverage.
Line Coverage: 58.44% (7554 / 12927)
Branch Coverage: 50.43% (1868 / 3704)
```

When branch coverage is not enabled it simply omits that line, so it appears like this:

```
Coverage report generated for (1/10), (10/10), (2/10), (3/10), (4/10), (5/10), (6/10), (7/10), (8/10), (9/10) to /Users/me/Development/cntral/coverage.
Line Coverage: 58.44% (7554 / 12927)
```
@amatsuda
Copy link
Member

amatsuda commented Sep 2, 2024

I like this new format indeed. So let me merge this.

@amatsuda amatsuda merged commit f6dc4ab into simplecov-ruby:main Sep 2, 2024
8 checks passed
@joshuapinter
Copy link
Contributor Author

@amatsuda 👏 🙏 Thank you. I totally forgot about this. :)

@joshuapinter joshuapinter deleted the put_coverage_percentage_first branch September 2, 2024 18:06
@noproblemwiththat
Copy link

For info, GitLab CI uses a regexp to extract the coverage percentage from simplecov output, and the above change breaks the previous regexp (as here) but once one knows that, it is fairly easy to fix.

No complaint about the change, just in case others are bitten by this 😄

@joshuapinter
Copy link
Contributor Author

@noproblemwiththat Thanks for posting this and I appreciate you saying no complaint. :) I figured it would break something but I think it's worth it for the sake of clarity. Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants