-
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.
Preserve trailing statement semicolons when using
fmt: skip
- Loading branch information
1 parent
e799f90
commit 44d4cac
Showing
5 changed files
with
85 additions
and
3 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
crates/ruff_python_formatter/resources/test/fixtures/ruff/fmt_skip/trailing_semi.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,10 @@ | ||
x = 1; # fmt: skip | ||
|
||
x = 1 ; # fmt: skip | ||
|
||
x = 1 \ | ||
; # fmt: skip | ||
|
||
x = 1 # ; # fmt: skip | ||
|
||
_; #unrelated semicolon |
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
34 changes: 34 additions & 0 deletions
34
crates/ruff_python_formatter/tests/snapshots/format@fmt_skip__trailing_semi.py.snap
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 @@ | ||
--- | ||
source: crates/ruff_python_formatter/tests/fixtures.rs | ||
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/fmt_skip/trailing_semi.py | ||
--- | ||
## Input | ||
```py | ||
x = 1; # fmt: skip | ||
x = 1 ; # fmt: skip | ||
x = 1 \ | ||
; # fmt: skip | ||
x = 1 # ; # fmt: skip | ||
_; #unrelated semicolon | ||
``` | ||
|
||
## Output | ||
```py | ||
x = 1; # fmt: skip | ||
x = 1 ; # fmt: skip | ||
x = 1 \ | ||
; # fmt: skip | ||
x = 1 # ; # fmt: skip | ||
_ # unrelated semicolon | ||
``` | ||
|
||
|
||
|
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