Closed
Description
Bug description
- Create a virtual environment (e.g. run
virtualenv pylint-repro
) - Activate the virtual environment (e.g. run
. pylint-repro/bin/activate
- Install pylint (e.g.
pip install pylint
) - Put these contents into an
example.py
file:
# pylint: disable=missing-docstring
def func():
# pylint: disable-next=unused-variable
test = 43
blah = 123
- Run
pylint example.py
- See the issue.
Configuration
No response
Command used
pylint example.py
Pylint output
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
Expected behavior
I expected the second unused variable to be reported, as is the case when not putting an empty line between disable-next
and the line I'm suppressing errors for:
# pylint: disable=missing-docstring
def func():
# pylint: disable-next=unused-variable
test = 43
blah = 123
Example output:
************* Module example
example.py:7:4: W0612: Unused variable 'blah' (unused-variable)
------------------------------------------------------------------
Your code has been rated at 6.67/10 (previous run: 6.67/10, +0.00)
It probably would also be fine if an empty line between the comment and line to suppress simply didn't work. My issue is that this appears to do what I've intended - it suppresses the unused variable for next line - but it also does things it wasn't supposed to.
Pylint version
pylint 2.15.0
astroid 2.12.5
Python 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0]
OS / Environment
Ubuntu 22.04.1, Python 3.10 shipped with the system
Additional dependencies
No response