Skip to content
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

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

Open
NoamNol opened this issue Nov 4, 2021 · 2 comments
Open

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

NoamNol opened this issue Nov 4, 2021 · 2 comments

Comments

@NoamNol
Copy link

NoamNol commented Nov 4, 2021

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
@Pierre-Sassoulas
Copy link
Collaborator

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

@carlio
Copy link
Contributor

carlio commented Mar 1, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants