Open pwithams opened 9 months ago
Have you taken a look at the resolver we aded in ruff_python_resolver
? It's based off Pyright's implementation.
@charliermarsh is the ruff_python_resolver
intended to be a solution to E0611
? I cant seem to find any documentation on what it is currently being used for.
Sure would be nice to get E0611
and E0401
implemented. I just ran into an edge case where these would have caught a file with some bad imports (as pylint
would have), but it was not invoked in any tests so it never got caught - until a user runtime error.
@charliermarsh In my opinion it should be implemented as well. We just missed a bug due to faulty import and ruff didn't catch the issue. Would be great to have a compatible implementation in our setup as ruff is our primary linter here.
https://github.com/django-cms/django-cms/issues/7992 We have this new issue because we added this faulty imported while backporting a feature, and this module is not in the 3.11 version of the project. Ruff passed the lint with flying colours where it should have pointed it out.
@MichaReiser Can this be prioritised, please?
I'm interested in implementing
no-name-in-module
(E0611) andimport-error
(E0401) for pylint (https://github.com/astral-sh/ruff/issues/970).I think this would handle this issue https://github.com/astral-sh/ruff/issues/6327 but as mentioned in that issue thread it might get a little complex with things like virtual environments.
I've taken a brief look at the resolver but wondering if there has been any other work into this issue before continuing. A couple of my thoughts:
ImportError
andModuleNotFoundError
, although it will return all errors, not just the first, with a line likeimport os.foobar
triggering both errorsimport-error
at least)? Could this ever be fully trustworthy? I'm guessing not.no-name-in-module
, especially when it comes to things like c libraries), are there ways to optimize/minimize python usage/runtime?