prospector icon indicating copy to clipboard operation
prospector copied to clipboard

[BUG] Wrong locally-disabled error when using with .pylintrc

Open NoamNol opened this issue 4 years ago • 2 comments
trafficstars

I have .pylintrc file in my project, and when I run prospector I get pylint - locally-disabled warnings about every # pylint: disable=some-rule comment in the code.

To fix it I need to add disable=locally-disabled to .pylintrc.

To Reproduce In mac:

python -m venv .env
source .env/bin/activate
pip install prospector

cat >> file.py <<EOL
# pylint: disable=consider-using-with
open('f.txt', encoding='utf8').close()
EOL

cat >> .pylintrc <<EOL
[MESSAGES CONTROL]
disable=missing-docstring
EOL

prospector

To fix:

rm .pylintrc
cat >> .pylintrc <<EOL
[MESSAGES CONTROL]
disable=missing-docstring,locally-disabled
EOL

prospector

Expected behavior No warning when using # pylint: disable=some-rule.

Environment:

  • OS: macOS
  • Tool: pylint
  • Prospector version: 1.5.1
  • Python version: 3.9.7

Additional context

❯ pip freeze
astroid==2.8.4
dodgy==0.2.1
flake8==3.9.2
flake8-polyfill==1.0.2
isort==5.10.0
lazy-object-proxy==1.6.0
mccabe==0.6.1
pep8-naming==0.10.0
platformdirs==2.4.0
prospector==1.5.1
pycodestyle==2.7.0
pydocstyle==6.1.1
pyflakes==2.3.1
pylint==2.11.1
pylint-celery==0.3
pylint-django==2.4.4
pylint-flask==0.6
pylint-plugin-utils==0.6
PyYAML==6.0
requirements-detector==0.7
setoptconf-tmp==0.3.1
snowballstemmer==2.1.0
toml==0.10.2
typing-extensions==3.10.0.2
wrapt==1.13.3

NoamNol avatar Nov 04 '21 18:11 NoamNol

Not wanting to activate this except in very particular occasion makes sense, I would merge a fix for that.

Pierre-Sassoulas avatar Nov 04 '21 19:11 Pierre-Sassoulas

Ah so this is a bit tricky - it's "forced" on for prospector to gather information, see https://github.com/PyCQA/prospector/blob/master/prospector/tools/pylint/init.py#L70

It should however not be emitted later if disabled elsewhere, only used internally.

I will look into this.

carlio avatar Mar 01 '22 12:03 carlio