-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Labels
C: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkFalse Negative 🦋No message is emitted but something is wrong with the codeNo message is emitted but something is wrong with the code
Milestone
Description
Bug description
Within functions used-before-assignment
doesn't get raised for some edge cases.
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from datetime import datetime
# pylint: disable=missing-function-docstring, missing-module-docstring
def func_two():
second = datetime.now()
return second
def func():
first: datetime
first = datetime.now()
second = datetime.now()
return first, second
Configuration
Default config.
Command used
pylint
Pylint output
************* Module test
test.py:10: [E0601(used-before-assignment), func_two] Using variable 'datetime' before assignment
-------------------------------------------------------------------
Your code has been rated at 4.55/10 (previous run: 10.00/10, -5.45)
Expected behavior
************* Module test
test.py:10: [E0601(used-before-assignment), func_two] Using variable 'datetime' before assignment
test.py:16: [E0601(used-before-assignment), func_two] Using variable 'datetime' before assignment
-------------------------------------------------------------------
Your code has been rated at 4.55/10 (previous run: 10.00/10, -5.45)
Pylint version
2.16.1
OS / Environment
/
Additional dependencies
No response
MaximMukhametov
Metadata
Metadata
Assignees
Labels
C: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkFalse Negative 🦋No message is emitted but something is wrong with the codeNo message is emitted but something is wrong with the code