Skip to content

Raise GREEN_THRESHOLD to 100 so only fully covered files rate green - #14

Merged
cesarjr merged 2 commits into
mainfrom
raise-green-threshold-to-100
Jun 10, 2026
Merged

Raise GREEN_THRESHOLD to 100 so only fully covered files rate green#14
cesarjr merged 2 commits into
mainfrom
raise-green-threshold-to-100

Conversation

@cesarjr

@cesarjr cesarjr commented Jun 9, 2026

Copy link
Copy Markdown
Member

Closes #13

Summary

Why: a file at 66.66% coverage rated 🟢 and passed the --fail-on-low-coverage gate, which made the green rating misleading — a file could be marked green with a third of it untested.

  • Raise Parser::GREEN_THRESHOLD from 66.66 to 100: 🟢 (and bg-success in the HTML report) now means the file is fully covered, and --fail-on-low-coverage exits 1 for any reported file below 100%. RED_THRESHOLD is unchanged, so 🟡 now spans 33.34%–99.99%.
  • Compare the unrounded covered_percent in low_coverage_files, percentage_indicator, and percentage_bar_color, so a file at e.g. 99.996% no longer rounds up to 100% and slips past the gate.
  • Display percentages with two decimal places in all cases (e.g. 60.00%), flooring instead of rounding, so a partially covered file never displays as 100.00% — a 99.996% file shows 99.99%, rates 🟡, and fails the build.
  • Update README (rating bands, gate docs, report example), add a 0.9.0 CHANGELOG entry flagging the breaking change, and bump the version to 0.9.0.
  • No change needed in lib/couve.rb: the stderr message and --help text interpolate the constant and now read "below 100%".

How to test

  • bundle exec rspec — 37 examples, 0 failures (developed with strict TDD: every behavior change landed as a failing spec first).
  • bundle exec rubocop — no offenses.
  • bundle exec exe/couve spec/fixtures/codeclimate.json tmp/report.md --fail-on-low-coverage — exits 1, prints couve: coverage below 100% in ..., and the report rates the 60.00%/83.33%/93.33% files 🟡.

Notes

Behavioral consequence worth knowing: the default (project-wide) report already hides fully covered files, so with this change every reported file is 🔴/🟡 and --fail-on-low-coverage fails whenever the report is non-empty. In practice the flag pairs with --changed-files, where a fully covered changed-file set still passes; this is now documented in the README. Released as 0.9.0 since it changes the gate behavior for existing users.

🤖 Generated with Claude Code

cesarjr and others added 2 commits June 9, 2026 17:58
)

The green rating and the --fail-on-low-coverage gate now require 100%
coverage. Ratings and the gate also compare the unrounded percentage,
so a file at 99.996% no longer rounds up to 100% and slips through;
rounding is kept for display only. Bump version to 0.9.0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Show every percentage with two decimal places (e.g. 60.00%) and floor
instead of rounding, so a partially covered file such as 99.996% shows
99.99% rather than a misleading 100.0% next to a yellow rating.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cesarjr
cesarjr merged commit 9e0b577 into main Jun 10, 2026
2 checks passed
@cesarjr
cesarjr deleted the raise-green-threshold-to-100 branch June 10, 2026 11:45
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.

Raise GREEN_THRESHOLD to 100 so only fully covered files rate green

1 participant