ruff: Ability to exit with non-zero after fixing errors
This is one of those infuriating reports asking for behavior opposite to that already requested.
In SciPy, we use ruff
in our pre-commit hook. We like that ruff is able to fix errors, but we still need a non-zero exit after doing so, so that the commit hook will fail and the user can re-commit.
I will address it for now by parsing the ruff output, but that’s not ideal.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 23 (13 by maintainers)
Alright I’ll add some CLI flags here. Won’t be tonight but should be this week.
Pre-commit already knows if files changed, so not sure knowing what files changes only would be useful. But knowing what rules were applied is big. Maybe you don’t agree with a rule and need to revert and exclude it. Maybe you learn about a new best practice you didn’t know about. Maybe it just deleted lines of code because print statements aren’t allowed (personally got surprised by that one). And so forth. Or maybe you need to report a broken fix but have no idea what was responsible (also been in that one).