-
-
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
pylint doesn't continue searching for files under a directory that is not a package #9764
Labels
Bug 🪲
namespace-package
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
Milestone
Comments
ocelotl
added
the
Needs triage 📥
Just created, needs acknowledgment, triage, and proper labelling
label
Jul 2, 2024
open-telemetry/opentelemetry-python#3814 to link these 2 issues. |
jacobtylerwalls
changed the title
Path of the checked directory affects pylint results
pylint doesn't continue searching for files under a directory that is not a package
Jul 4, 2024
Thanks for the report, I'm showing this is fixed with: diff --git a/pylint/lint/expand_modules.py b/pylint/lint/expand_modules.py
index 04e701884..f40bdeea5 100644
--- a/pylint/lint/expand_modules.py
+++ b/pylint/lint/expand_modules.py
@@ -122,7 +122,7 @@ def expand_modules(
)
except ImportError:
# Might not be acceptable, don't crash.
- is_namespace = False
+ is_namespace = not os.path.exists(filepath)
is_directory = os.path.isdir(something)
else:
is_namespace = modutils.is_namespace(spec) Needs confirmation and a regression test. |
jacobtylerwalls
added
namespace-package
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
Bug 🪲
and removed
Needs triage 📥
Just created, needs acknowledgment, triage, and proper labelling
labels
Jul 4, 2024
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Bug 🪲
namespace-package
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
Bug description
This bug is happening when running
pylint
in this repo at this commit.I noticed different behaviors when running
cd propagator; pylint opentelemetry-propagator-b3
and when runningpylint propagator/opentelemetry-propagator-b3
.I found this issue while working on this other issue.
Configuration
The
pylint
configuration is here.Command used
I cloned that repo, and run
tox -e lint
first to create thelint
virtual environment. Then I activated thelint
virtual environment:source .tox/lint/bin/activate
.I ran
pylint propagator/opentelemetry-propagator-b3
.Then I ran
cd propagator
and then I ranpylint opentelemetry-propagator-b3
.Pylint output
When I ran
pylint propagator/opentelemetry-propagator-b3
I got this output:When I ran
cd propagator
and then I ranpylint opentelemetry-propagator-b3
I got this output:Expected behavior
I expected the behavior would be the one that happens when I run
cd propagator
and then I runpylint opentelemetry-propagator-b3
in both cases.Pylint version
(lint) tigre@hilleman:~/github/ocelotl/opentelemetry-python/propagator$ pylint --version pylint 3.0.2 astroid 3.0.3 Python 3.11.2 (main, Feb 12 2023, 12:17:23) [GCC 11.3.0]
OS / Environment
Additional dependencies
The text was updated successfully, but these errors were encountered: