-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e85fe87
commit eecc2af
Showing
4 changed files
with
136 additions
and
32 deletions.
There are no files selected for viewing
55 changes: 34 additions & 21 deletions
55
crates/ruff_linter/resources/test/fixtures/pylint/control_var_used_after_block.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,49 @@ | ||
import typing | ||
from typing import cast | ||
|
||
# TODO: Figure this out | ||
# for global_var in []: | ||
# _ = global_var | ||
# pass | ||
|
||
# _ = global_var | ||
|
||
def foo(): | ||
# For control var used outside block | ||
for event in []: | ||
_ = event | ||
pass | ||
|
||
_ = event | ||
|
||
# # Tuple destructuring | ||
# for a, b, c in []: | ||
# pass | ||
for a, b, c in []: | ||
pass | ||
|
||
# _ = a | ||
# _ = b | ||
# _ = c | ||
_ = a | ||
_ = b | ||
_ = c | ||
|
||
|
||
# # Array destructuring | ||
# for [d, e, f] in []: | ||
# pass | ||
|
||
# _ = d | ||
# _ = e | ||
# _ = f | ||
|
||
# # With -> for, variable reused | ||
# with None as i: | ||
# for i in []: # error | ||
# pass | ||
|
||
# # For -> with, variable reused | ||
# for i in []: | ||
# with None as i: # error | ||
# pass | ||
for [d, e, f] in []: | ||
pass | ||
|
||
_ = d | ||
_ = e | ||
_ = f | ||
|
||
with None as i: | ||
pass | ||
|
||
_ = i | ||
|
||
with None as i: | ||
for n in []: | ||
pass | ||
|
||
_ = n | ||
|
||
_ = n | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters