-
Notifications
You must be signed in to change notification settings - Fork 658
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 is not actually checking some test files #3814
Comments
With some scripting and modifying pylint to print out files analyzed following this SO, I think there are 51 files not being linted: Show files
These are all within test directories that don't have an |
From a quick glance may not be the most useful warnings to be honest. Is ruff finding them? |
I think ruff recursively finds all files in the filesystem so would be checking them. It doesn't try to do fancy inference so doesn't need to be aware of the module path for the files afaict. Pylint seems to rely on the presence of $ pylint opentelemetry-api/src/opentelemetry/
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
$ pylint --recursive=y opentelemetry-api/src/opentelemetry/
************* Module opentelemetry.baggage
opentelemetry-api/src/opentelemetry/baggage/__init__.py:17:0: E0611: No name 'MappingProxyType' in module 'types' (no-name-in-module)
************* Module opentelemetry.trace.span
opentelemetry-api/src/opentelemetry/trace/span.py:190:32: E1101: Module 'types' has no 'TracebackType' member (no-member)
************* Module opentelemetry.trace.propagation.tracecontext
opentelemetry-api/src/opentelemetry/trace/propagation/tracecontext.py:54:16: E1101: Module 're' has no 'search' member (no-member)
------------------------------------------------------------------
Your code has been rated at 9.89/10 (previous run: 9.89/10, +0.00) I think what's happening is pylint is using the The worst part is that |
Maybe this is the culprit pylint-dev/pylint#3944 EDIT yup that actually fixes it. I tried deleting |
@aabmass If ruff is fine then we will be fine once we start using it no? I won't bother with missing pylint warning in tests. |
Do you actually mean
? |
So, I tried this: I ran
I modified this file diff --git a/pylinter.py b/pylinter.py
index e21d8b5..233f9e9 100644
--- a/pylinter.py
+++ b/pylinter.py
@@ -874,6 +874,7 @@ class PyLinter(
for descr in self._expand_files(files_or_modules).values():
name, filepath, is_arg = descr["name"], descr["path"], descr["isarg"]
if self.should_analyze_file(name, filepath, is_argument=is_arg):
+ print(name)
yield FileItem(name, filepath, descr["basename"])
def _expand_files( Now, when we run I noticed that if I ran
But if I ran
So, it seems like we just need to run |
Seems like the fix is pretty easy, we just need to run |
I tried implementing this in the contrib repo, apparently it is also important that |
I don't think that is necessary if you set
I think either way would do the trick. It expects namespaces packages with no |
Sorry, set what? 🤔 |
I realized today that possibly large swaths of the codebase are not being checked by pylint. It seems like it is not recursing into directories that don't have an
__init__.py
(namespace packages) AND aren't insys.path
/PYTHONPATH
.tox -e lint
installs the packages (not tests) into it's venv and then runspython scripts/eachdist.py lint --check-only
which in turn runs pylint on directory rootstests/
andsrc/opentelemetry
dirs:pylint opentelemetry-api/tests \ opentelemetry-api/src/opentelemetry # ...
If I invoke this command in the venv with the tests directory:
If I invoke on a specific file in a dir without an
__init__.py
:The text was updated successfully, but these errors were encountered: