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

[unknown-option-value] False negative after --disable=all #9403

Closed
buhtz opened this issue Jan 31, 2024 · 3 comments · Fixed by #9491 or #9940
Closed

[unknown-option-value] False negative after --disable=all #9403

buhtz opened this issue Jan 31, 2024 · 3 comments · Fixed by #9491 or #9940
Labels
False Negative 🦋 No message is emitted but something is wrong with the code Good first issue Friendly and approachable by new contributors Needs PR This issue is accepted, sufficiently specified and now needs an implementation Work in progress
Milestone

Comments

@buhtz
Copy link

buhtz commented Jan 31, 2024

Bug description

The option --enable does not give an error when an unknown error code is used. It should give an error.

What I was trying is to enable just a group of warnings. I tried W1 and W1*. No error but also no warning. But the code does have some W1203 problems in it.

Configuration

No response

Command used

pylint --disable=all --enable=foobar bandas.py

Pylint output

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

Expected behavior

Give an error.

Pylint version

pylint 2.17.7
astroid 2.15.8
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0]

OS / Environment

Debian 12 arm64

Additional dependencies

No response

@buhtz buhtz added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Jan 31, 2024
@jacobtylerwalls
Copy link
Member

Reproduced @ 51c28bc

pylint --enable=missnig-docstring pylint/checkers/utils.py
************* Module Command line
Command line:1:0: W0012: Unknown option value for '--enable', expected a valid pylint message and got 'missnig-docstring' (unknown-option-value)

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
pylint --disable=all --enable=missnig-docstring pylint/checkers/utils.py
No files to lint: exiting.

@jacobtylerwalls jacobtylerwalls changed the title No error message about unknown error-warning-codes [unknown-option-value] False negative after --disable=all Jan 31, 2024
@jacobtylerwalls jacobtylerwalls added False Negative 🦋 No message is emitted but something is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation Good first issue Friendly and approachable by new contributors and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jan 31, 2024
@fellhorn
Copy link
Contributor

As I also ran into this issue I started debugging it to check for a fix.

The reason seems to be that --disable=all also disables the unknown-option-value messages.
Thus when running

pylint --disable=all --enable=unknown-option-value,missnig-docstring pylint/checkers/utils.py
************* Module Command line
Command line:1:0: W0012: Unknown option value for '--enable', expected a valid pylint message and got 'missnig-docstring' (unknown-option-value)

------------------------------------
Your code has been rated at 10.00/10

the results is again as expected.

While I understand this behavior for --disable=all, I think it is not very intuitive from a user perspective. I did not expect to silent pylint error messages, most people would assume it only silents linting errors.

Would it make sense to have internal pylint errors not being affected by --disable=all?

@jacobtylerwalls
Copy link
Member

Yep, exactly! This issue is ready for a contributor to tackle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Negative 🦋 No message is emitted but something is wrong with the code Good first issue Friendly and approachable by new contributors Needs PR This issue is accepted, sufficiently specified and now needs an implementation Work in progress
Projects
None yet
4 participants