-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary format StmtFor still trying to learn how to help out with the formatter. trying something slightly more advanced than [break](#5158) mostly copied form StmtWhile ## Test Plan snapshots
- Loading branch information
1 parent
e71f044
commit 1eccbbb
Showing
14 changed files
with
390 additions
and
132 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/for.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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
for x in y: # trailing test comment | ||
pass # trailing last statement comment | ||
|
||
# trailing for body comment | ||
|
||
# leading else comment | ||
|
||
else: # trailing else comment | ||
pass | ||
|
||
# trailing else body comment | ||
|
||
|
||
for aVeryLongNameThatSpillsOverToTheNextLineBecauseItIsExtremelyLongAndGoesOnAndOnAndOnAndOnAndOnAndOnAndOnAndOnAndOn in anotherVeryLongNameThatSpillsOverToTheNextLineBecauseItIsExtremelyLongAndGoesOnAndOnAndOnAndOnAndOnAndOnAndOnAndOnAndOn: # trailing comment | ||
pass | ||
|
||
else: | ||
... | ||
|
||
for ( | ||
x, | ||
y, | ||
) in z: # comment | ||
... | ||
|
||
|
||
# remove brackets around x,y but keep them around z,w | ||
for (x, y) in (z, w): | ||
... | ||
|
||
|
||
# type comment | ||
for x in (): # type: int | ||
... |
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
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.