pylint icon indicating copy to clipboard operation
pylint copied to clipboard

Inline disable comments conflicts with ``--disable=W`` CLI argument

Open Redoubts opened this issue 3 years ago • 1 comments

Steps to reproduce

script:

import os

# pylint: disable=unused-import
from sys import exit

print("Hi")

If you run plain pylint on this, you get "W0611: Unused import os (unused-import)" as expected. But if you run pylint --disable=W, you still get the same warning, even though I expected all warnings to be disabled.

Note that if the pylint comment is placed on the same line as the last import:

import os
from sys import exit  # pylint: disable=unused-import

print("Hi")

then pylint --disable=W returns 10/10 as expected.

pylint --version output

% pylint --version                
pylint 2.6.0
astroid 2.4.2
Python 3.6.5

Redoubts avatar Nov 16 '20 19:11 Redoubts

@Redoubts thanks for the report. It seems to be a bug.

hippo91 avatar Nov 19 '20 17:11 hippo91