-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Inconsistent and sometimes incorrect false positive of no-member
error
#9883
Comments
no-member
error
Thanks for the analysis.
We should definitely remove that indeterminacy. Would you like to prepare a PR? I don't think a regression test is needed in this case. |
Will send one sometime this week. |
This could be much more broad error than in description. In my case pylint 3.2.6 sometimes fails to find symbols from |
I think the fix needed is to provide the context file (ie |
I'm looking at the toy example you provided above and I wanted to confirm that the issue is present, but I think the issue is also not 100% solved by the associated PR alone (but maybe it'll be solved with the accompanying PR in Commit tested: 8314743 (current For simplicity, I disabled the docstring and import warnings just to reduce the noise. Example 1 (directory before
|
Now I can confirm that hypothesis. Tested previous commit (724fd5e) and had So it is not only about two modules with the same name, but about modules order in general - the issue is much more broad and severe! In my case I use wildcard imports (disabled When new version of pylint to be released? Are there plans to backport this fix to |
That is correct. The order matters and the fix (#9887) that got merged in only addresses the randomness of the error. The full fix may be tricky to fix and will need further discussion. I am trying to fix the issue in #9910 but have run into regression test failures. These failures will need further discussion that I will open an issue for to discuss further in the coming days. |
Created #9915 to discuss the issue I ran into. |
As discussed in the above issue #9915, this is tied to the current behavior of module search paths. When an argument is passed to |
Bug description
I am seeing an issue with a sometimes false positive when using two modules with the same name but one of them under separate namespace. The following is the directory structure and contents:
Command run:
There seems to be some kind of module name conflict with
module
happening and sometimes I see ano-member
error in the output even though themain
function is defined inmodule/__init__.py
When taking a closer look and trying to debug this, at least the non-deterministic behavior seems to stem from https://github.com/pylint-dev/pylint/blob/main/pylint/lint/pylinter.py#L667 where the code is trying to convert a set of paths to a list.
Command used
Pylint output
Depending on the run, I see different outputs (one is correct and the other is incorrect):
Output 1 (correct):
Output 2 (false
no-member
error):Expected behavior
************* Module package1.module
package1/module/init.py:1:0: C0114: Missing module docstring (missing-module-docstring)
package1/module/init.py:1:0: C0116: Missing function or method docstring (missing-function-docstring)
************* Module test
test.py:3:0: W0611: Unused import package1.module (unused-import)
Pylint version
OS / Environment
Darwin Kernel Version 23.4.0: Fri Mar 15 00:19:22 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8112 arm64
I am also able to reproduce on Windows 10 WSL 2 (Ubuntu 22.04)
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: