Closed iulian-birlica closed 2 years ago
# pylint: disable=missing-docstring import random def function(): if random.randrange(2) == 0: test = "something" print(test) else: print(test) # pylint should complain
No response
pylint test.py
------------------------------------ Your code has been rated at 10.00/10
Expected some kind of undefined variable warning.
pylint 2.15.2 astroid 2.12.9 Python 3.9.2 (default, Dec 16 2021, 12:56:11) [GCC 6.3.0 20170516]
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 9.13 (stretch) Release: 9.13 Codename: stretch
Thanks for the report. undefined-variable and used-before-assignment are almost synonymous. Duplicate of #1727
undefined-variable
used-before-assignment
Bug description
Configuration
No response
Command used
Pylint output
Expected behavior
Expected some kind of undefined variable warning.
Pylint version
OS / Environment
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 9.13 (stretch) Release: 9.13 Codename: stretch
Additional dependencies
No response