-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Make UP028
always fixable again
#16496
Comments
I consider adding such a fix low priority as this pattern should be rare. I'm okay adding it if it has low complexity. I believe Ruff already has a functionality to introduce new names but that can fail (because of overlaps?) |
@MichaReiser Generating a new name can never fail: Ruff just needs to check all names of the form The examples above are all about |
The point of UP028 is to recommend |
That's a much better idea. Consider this a rule request then. |
I'll close this. Feel free to open a new issue if you want to request a rule. A new issue makes it easier to find and should document its motivation |
After #16451,
UP028
is no longer always fixable. However, a different kind of fix can be offered in such cases:I can't think of any edge cases, other than that adding a new name to the scope might break runtime inspections:
Also consider the case where the new name is the same as an existing one:
Generating a new, unique variable name is trivial, but it does, however, necessitate the fix being marked as unsafe to give the user a chance to review that name (along with everything else).
The text was updated successfully, but these errors were encountered: