-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
C: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkControl flowRequires control flow understandingRequires control flow understandingEnhancement ✨Improvement to a componentImprovement to a component
Description
Current problem
See this example
from unittest import TestCase
import os
class TestX(TestCase):
def test_foo(self):
if 'FOO' in os.environ:
x = 1
else:
self.fail()
print(x) # E0606:possibly-used-before-assignment
Although there is no way to reach the last line without x being unassigned it is reported as such.
Desired solution
self.fail() should be detected as terminating similar to raise ...
Additional context
No response
Metadata
Metadata
Assignees
Labels
C: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkControl flowRequires control flow understandingRequires control flow understandingEnhancement ✨Improvement to a componentImprovement to a component