Skip to content
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

Request: Autofix for future-annotations-in-stub/PYI044 #14186

Closed
Avasam opened this issue Nov 8, 2024 · 3 comments
Closed

Request: Autofix for future-annotations-in-stub/PYI044 #14186

Avasam opened this issue Nov 8, 2024 · 3 comments
Labels
fixes Related to suggested fixes for violations help wanted Contributions especially welcome

Comments

@Avasam
Copy link

Avasam commented Nov 8, 2024

This one sounds like a pretty safe autofix, as the description of the rule says: "from __future__ import annotations has no effect in stub files". It's basically the same autofix as https://docs.astral.sh/ruff/rules/unused-import/

@MichaReiser MichaReiser added fixes Related to suggested fixes for violations help wanted Contributions especially welcome labels Nov 8, 2024
@dylwil3
Copy link
Collaborator

dylwil3 commented Nov 8, 2024

I think this autofix already exists but it's currently in preview.

echo "from __future__ import annotations" > tmp.pyiruff check tmp.pyi --select PYI --preview --fix
Found 1 error (1 fixed, 0 remaining).cat tmp.pyi

@InSyncWithFoo
Copy link
Contributor

It was added a while ago in #12676. The fix is both safe and small, so it probably won't have to stay in preview for much longer.

@MichaReiser MichaReiser closed this as not planned Won't fix, can't repro, duplicate, stale Nov 8, 2024
@Avasam
Copy link
Author

Avasam commented Nov 8, 2024

Ah I must've missed it being in preview then. I thought I did run with --preview, but maybe not. Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixes Related to suggested fixes for violations help wanted Contributions especially welcome
Projects
None yet
Development

No branches or pull requests

4 participants