ungrouped-imports
/ wrong-import-order
: FP because only two isort's options are taken into account
#9977
Labels
False Positive 🦟
A message is emitted but nothing is wrong with the code
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
Current problem
There's this PEP 421 implicit namespace we're using. I'll call it an
ecosystem_namespace
in this example. It has a special project providing aecosystem_namespace.interfaces
which is kinda a platform spec or a framework for all the other projects in this namespace. So it must always be imported before any other packages in the namespace, including the local ones.When I configure isort as follows
it helps me get the following order in the import section structure:
isort is able to understand that
ecosystem_namespace.interfaces
is a separate thing that must reside in its own category in a defined place.However, pylint yields
ungrouped-imports
andwrong-import-order
, despite relying onisort
internally.Additionally, the error messages in the pylint output imply that it treats the namespace (
ecosystem_namespace
) as a first-party package, which is nowhere near being true.Desired solution
I believe, the
ungrouped-imports
andwrong-import-order
checks should always pass when the import order matches the existing isort configuration. And it should be able to understand that namespace packages aren't first-party.Additional context
Looking into
pylint/pylint/utils/utils.py
Lines 365 to 366 in 0972ba5
The text was updated successfully, but these errors were encountered: