fix: make --dry-run correctly report formatting issues#257
Conversation
Problem: --dry-run mode always returned 0, never blocking commits even when clang-format detected unformatted files. This was caused by: 1. run_clang_format() replacing the actual exit code with -1 2. main() converting -1 back to 0 This contradicted user intuition (dry-run should fail if formatting needs fixing) and differed from mirrors-clang-format's behavior. Fix: - Remove the special -1 code path entirely - Auto-inject --Werror when --dry-run is present, so clang-format returns non-zero when formatting changes are needed (mirrors-clang- format behavior) - Pass through the real exit code from clang-format Tests updated: dry-run on unformatted file expects 1, on formatted file expects 0.
|
Warning Review limit reached
Next review available in: 46 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
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. Comment |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #257 +/- ##
=======================================
Coverage 97.51% 97.51%
=======================================
Files 3 3
Lines 241 241
=======================================
Hits 235 235
Misses 6 6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will not alter performance
Performance Changes
Comparing Footnotes
|



Problem: --dry-run mode always returned 0, never blocking commits even when clang-format detected unformatted files. This was caused by:
This contradicted user intuition (dry-run should fail if formatting needs fixing) and differed from mirrors-clang-format's behavior.
Fix:
Tests updated: dry-run on unformatted file expects 1, on formatted file expects 0.
Summary
Related Issues