-
Notifications
You must be signed in to change notification settings - Fork 879
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Continuing implementation of RUF028. Several edge cases have been add…
…ressed and several new problems are now reported. Edge cases involving dangling comments still need to be handled
- Loading branch information
1 parent
b1c1e54
commit 2de4f0a
Showing
4 changed files
with
551 additions
and
94 deletions.
There are no files selected for viewing
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,21 +1,78 @@ | ||
|
||
def fmt_off_in_elif(): | ||
# fmt: on | ||
def fmt_off_used_earlier(): | ||
if True: | ||
pass | ||
a = 5 | ||
with a: | ||
# fmt: off | ||
pass | ||
elif False: | ||
# fmt: off | ||
pass | ||
else: | ||
pass | ||
# fmt: off | ||
if True: | ||
# fmt: off | ||
pass | ||
# fmt: off | ||
|
||
# fmt: off | ||
|
||
# fmt: on | ||
|
||
|
||
def fmt_off_between_lists(): | ||
test_list = [ | ||
#fmt: off | ||
# fmt: off | ||
1, | ||
2, | ||
3 | ||
3, | ||
] | ||
|
||
@fmt_off_in_elif | ||
|
||
@fmt_on_after_func | ||
# fmt: off | ||
@fmt_off_between_lists | ||
def fmt_off_between_decorators(): | ||
# fmt: skip | ||
pass | ||
|
||
def fmt_on_trailing(): | ||
# fmt: off | ||
val = 5 # fmt: on | ||
pass | ||
|
||
def fmt_off_in_else(): | ||
x = [1, 2, 3] | ||
for val in x: | ||
print(x) | ||
# fmt: off | ||
else: | ||
print("done") | ||
while False: | ||
print("while") | ||
# fmt: on | ||
# fmt: off | ||
else: | ||
print("done") | ||
if len(x) > 3: | ||
print("huh?") | ||
# fmt: on | ||
# fmt: off | ||
else: | ||
print("expected") | ||
|
||
def dangling_fmt_off(): | ||
pass | ||
# fmt: off | ||
|
||
def dangling_fmt_off2(): | ||
if True: | ||
if True: | ||
pass | ||
else: | ||
pass | ||
# fmt: off | ||
else: | ||
pass | ||
# fmt: off |
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
Oops, something went wrong.