-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cleanup-after-fix #451
Comments
For reference, we do fix until convergence if you run |
Yes, I was in a hurry when I wrote astral-sh/ruff#10954, but now I see. Perhaps, I should rename this issue to cleanup-after-fix? |
Doesn't |
Not exactly. Suppose I have lots of ugly code below which I do not want to touch just yet. But I am ready to fix the imports. In this situation I cannot run |
I see. Thanks for sharing that. I think astral-sh/ruff#4361 could potentially solve this at least when working from the command-line. I'm not sure what it would look like in the editor. |
TL;DR
Some fixes, when applied, create conditions for other fixes.
On one hand, I understand that VSCode extension fixes one thing at a time (and this is by design). On the other hand, it is not fun to fix violations created by the tool.
I would like to have a configuration option for ruff to clean up after itself:
An example
Recently I went through a large code base, adding
from __future__ import annotations
where it missed. This simple change started a cascade of other changes.This code is flagged with TCH002 ("Move
numpy.typing
into a type-checking block"):I obediently
click Ctrl_+.
and select a quick fix.Now, this code is flagged with I001 ("Import block is unsorted"), because
TypeAlias, TYPE_CHECKING
are in the wrong order, and there is an extra newline beforeif TYPE_CHECKING
:Clicking again, I get the final version:
Sometimes the chain is longer than two steps, but I cannot reproduce it now.
The text was updated successfully, but these errors were encountered: