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: Add option to move imports into type checking block automatically #159

Open
Xemorr opened this issue Aug 2, 2023 · 1 comment

Comments

@Xemorr
Copy link

Xemorr commented Aug 2, 2023

Hi, It would be great if there was an option to move an import into a type checking block automatically if it detects an issue.

@sondrelg
Copy link
Member

sondrelg commented Aug 2, 2023

Yeah I agree, that would be very nice ☺️

Changing code for the user doesn't seem in the spirit of how flake8 is supposed to work though, so I don't think this is the best place to implement such behavior. Luckily some work has been done to port the logic to ruff, including some automatic fixing already, I believe.

Looking at the current state of things, I think ruff just needs to finish implementing TC100/TC101 and TC200/TC201 for it to work properly. Without those, the plugin can produce code that might fail at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants