mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
Python: Add false positive test example for issue #2652.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
| type_annotation_fp.py:5:5:5:7 | foo | The value assigned to local variable 'foo' is never used. |
|
||||
| variables_test.py:29:5:29:5 | x | The value assigned to local variable 'x' is never used. |
|
||||
| variables_test.py:89:5:89:5 | a | The value assigned to local variable 'a' is never used. |
|
||||
| variables_test.py:89:7:89:7 | b | The value assigned to local variable 'b' is never used. |
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# FP Type annotation counts as redefinition
|
||||
# See https://github.com/Semmle/ql/issues/2652
|
||||
|
||||
def type_annotation(x):
|
||||
foo = 5
|
||||
if x:
|
||||
foo : int
|
||||
do_stuff_with(foo)
|
||||
else:
|
||||
foo : float
|
||||
do_other_stuff_with(foo)
|
||||
Reference in New Issue
Block a user