| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: f8690345-28e5-4992-95b2-ae41cebf46d5 📥 CommitsReviewing files that changed from the base of the PR and between 41df972 and 616bdaf. 📒 Files selected for processing (2)
Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review. 📝 Walkthrough WalkthroughThe package adds supports_color() and uses it to enable or disable ANSI color constants. Tests cover TTY status, TERM, FORCE_COLOR, and module reload behavior. ChangesTerminal color support
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to 616bd This localized CLI change gates ANSI color for non-TTY output, and no concrete user or production risk remains at the current head; it is merge-ready after normal checks. Suggested reviewers: shenxianpeng 🚥 Pre-merge checks | ✅ 5 ✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. ❤️ ShareComment @coderabbitai help to get the list of available commands. |
Sorry, something went wrong.
|
Sorry, something went wrong.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #551 +/- ##
==========================================
+ Coverage 98.13% 98.14% +0.01%
==========================================
Files 12 12
Lines 1337 1348 +11
==========================================
+ Hits 1312 1323 +11
Misses 25 25 ☔ View full report in Codecov by Harness.
|
Sorry, something went wrong.
There was a problem hiding this comment.
Thank you for your PR!
Sorry, something went wrong.
Merging this PR will not alter performance✅ 490 untouched benchmarks Performance Changes
Comparing larsch:bugfix/tty-aware-color-output (616bdaf) with main (60d7586)2 Footnotes
|
Sorry, something went wrong.
supports_color() from #551 answered FORCE_COLOR, the TTY and TERM, but not NO_COLOR — the variable users actually export globally to opt out of color (https://no-color.org). Any non-empty value now disables color, outranking detection and yielding only to an explicit FORCE_COLOR. Two gaps in the #551 tests are closed alongside. The reload-based tests recomputed the module constants under a patched environment and left the last reload's values in place for every test that ran afterwards; a fixture now re-derives them on teardown. And nothing exercised the copies commit_check.util binds at import — the ones the print functions actually read — so two subprocess tests now run the real import path end to end and assert on what gets printed.
supports_color() from #551 answered FORCE_COLOR, the TTY and TERM, but not NO_COLOR — the variable users actually export globally to opt out of color (https://no-color.org). Any non-empty value now disables color, outranking detection and yielding only to an explicit FORCE_COLOR. Two gaps in the #551 tests are closed alongside. The reload-based tests recomputed the module constants under a patched environment and left the last reload's values in place for every test that ran afterwards; a fixture now re-derives them on teardown. And nothing exercised the copies commit_check.util binds at import — the ones the print functions actually read — so two subprocess tests now run the real import path end to end and assert on what gets printed.
| Back | FazBrowse Home | New Git URL |
Problem
The CLI emitted raw ANSI color escapes unconditionally. RED, GREEN,
YELLOW, and RESET_COLOR were hardcoded escape sequences in
commit_check/__init__.py, and print_error_message / print_suggestion
wrapped output in them without checking whether stdout is a terminal. Piped or
redirected output (CI logs, agent harnesses, files) therefore contained escape
garbage.
Fix
Add a supports_color() probe that mirrors the existing
supports_hyperlinks() convention, and gate the constants themselves:
matching the FORCE_HYPERLINK convention already documented in
supports_hyperlinks().
is the same deliberate "no terminal type" signal as dumb, while an unset
TERM still allows color on a real terminal.
Moving the decision to the constant definitions means commit_check/util.py
is unchanged: the print functions keep interpolating the constants, which are
already empty when color is off.
Tests
Summary by CodeRabbit
New Features
Tests