pylint-dev / pylint

It's not just a linter that annoys you!
https://pylint.readthedocs.io/en/latest/
GNU General Public License v2.0
5.32k stars 1.14k forks source link

Possible false-negative for `unused-argument` when function always raises #9935

Open e-gebes opened 1 month ago

e-gebes commented 1 month ago

Bug description

def function1(value):  # argument is used
    return value

def function2(value):  # argument is unused, Pylint correctly reports it
    return 2

def function3(value):  # argument is unused, Pylint does not report
    raise ValueError

Configuration

No response

Command used

pylint a.py

Pylint output

************* Module a
5:14: W0613: Unused argument 'value' (unused-argument)

Expected behavior

I would expect that also in case of an unconditional raise the argument would be reported as unused.

Pylint version

pylint 2.17.7
astroid 2.15.8
Python 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0]

OS / Environment

No response

Additional dependencies

No response

akamat10 commented 1 month ago

This can be reproduced with the latest pylint version. Seems to be a bug.