autoflake
autoflake copied to clipboard
[Feature request] Ignore import-only files
If there's an option to do this, I didn't find it.
I think it would be useful to have a configuration to skip over files that exclusively have imports in them (the same way __init__.py
files can be excluded). Files like these are usually the result of template-code generation that have not yet had the full code be implemented, but the required imports are automatically placed before being used.
A practical use-case of this configuration is Django startapp. Using this django command will create a bunch of files with imports in them and no other code, that should be extended and completed. Using autoflake in-between implementations cause these other files to be unnecessarily wiped clean, leaving empty files behind. This is even a bigger problem if autoflake is running in CI/CD.