-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed as not planned
Closed as not planned
Copy link
Labels
C: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkDuplicate 🐫Duplicate of an already existing issueDuplicate of an already existing issue
Description
Bug description
# pylint: disable=missing-module-docstring,invalid-name
a = bool(input("Enter something or nothing: "))
if a:
b = "1234"
# pylint doesn't understand this one
if not a:
pass
else:
print(b)
# pylint does understand this one
if a:
print(b)
else:
pass
Configuration
No response
Command used
pylint test.py
Pylint output
************* Module test
test.py:11:10: E0606: Possibly using variable 'b' before assignment (possibly-used-before-assignment)
------------------------------------------------------------------
Your code has been rated at 4.44/10 (previous run: 4.44/10, +0.00)
Expected behavior
Pylint should understand both if a: ...
and if not a: pass; else: ...
Pylint version
pylint 3.2.0
astroid 3.2.0
Python 3.11.7 | packaged by conda-forge | (main, Dec 23 2023, 14:43:09) [GCC 12.3.0]
OS / Environment
No response
Additional dependencies
No response
Metadata
Metadata
Assignees
Labels
C: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkDuplicate 🐫Duplicate of an already existing issueDuplicate of an already existing issue