-
Notifications
You must be signed in to change notification settings - Fork 61
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
Update imports with autofix #170
Comments
Would love to hear if there's a way to do this! I could totally guess that I missed something obvious in the API, but AddImportsVisitor in libcst is so handy and doesn't have a trivial mapping, it seems. |
I don't think this is possible at the moment, but agreed would be very useful. Unfortunately this feature would require rethinking how the replacement API works (currently you can only declare autofixes in the node you're visiting). Or at least adding a special case for imports. @amyreese what do you think? |
I believe this should be possible in the upcoming 2.0 release, but would require a separate call to |
Hi, I'm looking into creating a rule telling users not to use a certain base class, but rather use a different one. Providing an autofix for this would require changing an import, which I can't figure out how to do. Is this currently possible?
For example I'd like to replace this:
with this:
I see that the
NoNamedTupleRule
leaves old imports in place and does not add an import fordataclasses
, so I'm half assuming this isn't possible at the moment. Any plans to add support for this? Let me know if there's anything I can do to help :)The text was updated successfully, but these errors were encountered: