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

Support exclusion of specific imports #302

Open
tjstum opened this issue Apr 5, 2024 · 2 comments
Open

Support exclusion of specific imports #302

tjstum opened this issue Apr 5, 2024 · 2 comments

Comments

@tjstum
Copy link

tjstum commented Apr 5, 2024

Sometimes we know that a particular import always has side effects and should never be removed. When running autoflake with --remove-all-unused-imports, there's not a way to say "everything except module X, Y and Z."

We can sprinkle # noqa around at each such sight, but I'm wondering if there would be appetite to support a flag like --never-remove or such (that's the inverse of --imports).

If there is some way to do this that I am unaware, please let me know and accept my apologies! If this is intentionally unsupported, that would also be helpful feedback. If this is of interest but just needs a contributor, I could take a look.

Thanks!

@fsouza
Copy link
Collaborator

fsouza commented Apr 15, 2024

I think this is reasonable. One question I have is whether you're using flake8 though? Just because we may be able to ignore it in autoflake, but if you're using flake8 it may still require the issue. Not sure if you care.

@tjstum
Copy link
Author

tjstum commented Apr 15, 2024

In our particular case, we are not otherwise using flake8.

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

No branches or pull requests

2 participants