opentelemetry-python icon indicating copy to clipboard operation
opentelemetry-python copied to clipboard

Pylint is not actually checking some test files

Open aabmass opened this issue 10 months ago • 8 comments

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 in sys.path/PYTHONPATH. tox -e lint installs the packages (not tests) into it's venv and then runs python scripts/eachdist.py lint --check-only which in turn runs pylint on directory roots tests/ and src/opentelemetry dirs:

pylint opentelemetry-api/tests \
  opentelemetry-api/src/opentelemetry 
  # ...

If I invoke this command in the venv with the tests directory:

$ pylint opentelemetry-api/tests

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

If I invoke on a specific file in a dir without an __init__.py:

$ pylint opentelemetry-api/tests/attributes/test_attributes.py 
************* Module test_attributes
opentelemetry-api/tests/attributes/test_attributes.py:24:4: C0103: Method name "assertValid" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]*|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern) (invalid-name)
opentelemetry-api/tests/attributes/test_attributes.py:30:4: C0103: Method name "assertInvalid" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]*|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern) (invalid-name)
opentelemetry-api/tests/attributes/test_attributes.py:114:8: C0206: Consider iterating with .items() (consider-using-dict-items)
opentelemetry-api/tests/attributes/test_attributes.py:133:8: C0206: Consider iterating with .items() (consider-using-dict-items)
opentelemetry-api/tests/attributes/test_attributes.py:139:8: C0206: Consider iterating with .items() (consider-using-dict-items)
opentelemetry-api/tests/attributes/test_attributes.py:151:8: C0206: Consider iterating with .items() (consider-using-dict-items)
opentelemetry-api/tests/attributes/test_attributes.py:161:8: C0206: Consider iterating with .items() (consider-using-dict-items)

-----------------------------------
Your code has been rated at 9.31/1

aabmass avatar Mar 28 '24 00:03 aabmass