Report unfixable diagnostics when using scan --update-all#2684
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughInteractive printer's accept-all mode now forwards highlights to the inner printer instead of suppressing output. This fix allows unfixable rules to be reported when ChangesInteractive Printer Highlight Processing Fix
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adjusts scan --update-all output behavior so that unfixable findings are still reported while fixable findings are auto-applied, and adds a regression test to validate that behavior.
Changes:
- Added CLI integration test covering
scan --update-allreporting only unfixable rules and applying fixes. - Updated interactive printing logic so
accept_allmode forwards results to the underlying printer rather than suppressing output.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/cli/tests/scan_test.rs | Adds a test ensuring --update-all applies fixable changes while still reporting unfixable rules. |
| crates/cli/src/print/interactive_print.rs | Changes accept_all behavior to print via the inner printer instead of returning early with no output. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2684 +/- ##
==========================================
+ Coverage 85.48% 86.44% +0.95%
==========================================
Files 116 116
Lines 20174 20174
==========================================
+ Hits 17246 17439 +193
+ Misses 2928 2735 -193 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks |
Problem I saw:
ast-grep scan --update-allapplies fixable rewrites, but it was also hiding diagnostics from rules that do not have a fix.In a mixed scan, the fixable rule was applied, but the remaining unfixable warning was not printed.
What I changed:
In accept-all mode, diff payloads still auto-confirm rewrites without printing the interactive diff preview.
Highlight diagnostics now continue through the normal printer, so unfixable findings are still shown after
--update-allapplies the available fixes.I also added CLI regression coverage with one fixable rule and one unfixable rule. The test checks that the fix is applied, the fixed rule is no longer reported, the unfixable rule is still printed, and stderr reports the applied change.
How I checked it:
I ran:
cargo fmt --all
cargo fmt --all -- --check
focused regression test, 1 test
full scan integration test, 31 tests
git diff --check
Closes #2681
Summary by CodeRabbit