-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
collections-named-tuple (PYI024): Potential for an unsafe autofix using Any
#16491
Comments
I don't know how an editor-only fix would help with the linked issue. It seems that they want an automated fix that they can apply to the entire code base. Automatically typing everything as That's why I'm still leaning towards not offering a fix until we have type inference and can guess the correct types (and e.g. not offer a fix if any or all fields infer as |
Might be out of scope, but a language server could have a contextual option to refactor from
Correct. I'd also have my reservations. ESlint has a concept of "editor only fixes" (aka suggestions), that can never be triggered through cli. It also allows them to display multiple possible fixes for the same issue. But I don't think Ruff does (does it?) |
Refactors is something I want but, but unfortunately, it is probably quiet far in the future :( I did a quick search and couldn't find an issue for refactor support. I'd prefer to close this issue in favor of an explicit ask for refactors (which PYI024 could make use of once implemented) |
Makes sense to me. This can be used as an example of a useful refactor without providing a full autofix. |
Summary
Reviving #8820 in light of jaraco/skeleton#165
The original issue didn't mention that an autofix (or editor suggestion) would be possible by typing the attributes as
Any
. I would of course consider this unsafe asAny
that this would conflict withUnknown
But, at least as an editor suggestion, it can help mechanically transform the code and get it most of the way there.
The text was updated successfully, but these errors were encountered: