RUF100 and E401 with auto-fix seem inconsistent
I have a Django app config that relies on importing some files on initialisation to get various functions in there registered. Having RUF100 enabled and running ruff with --fix, the following happens. The original looks like this:
import api.checks # noqa: F401
import api.signals # noqa: F401
import app.celery # noqa: F401
import tools.something # noqa: F401
Running ruff will 'fix' it to the following, which seems incorrect (api.checks isn't used in this file) but will work and stay like that across multiple ruff runs:
import api.checks
import api.signals # noqa: F401
import app.celery # noqa: F401
import tools.something # noqa: F401
However if I modify it further to:
import api.checks
import api.signals
import app.celery # noqa: F401
import tools.something # noqa: F401
Both lines will get deleted the next time I run ruff and I end up with:
import app.celery # noqa: F401
import tools.something # noqa: F401
Pyflakes has the same behavior. I need to look back at our code to understand why. It has to do with submodule imports, which are kind of complicated (e.g., import api.checks in lieu of from api import checks).
I think we can probably flag both of these as unused if api is never used.
import api.checks # noqa: F401
import api.signals as signals # noqa: F401
Aliasing works (not sure why though)
Related: #60