-
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.
Allow additional text to folllow formatter pragma comments
- Loading branch information
Showing
5 changed files
with
126 additions
and
1 deletion.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
crates/ruff_python_formatter/resources/test/fixtures/ruff/fmt_on_off/reason.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,27 @@ | ||
# fmt: off | ||
x = 1 | ||
# fmt: on | ||
|
||
# fmt: off reason | ||
x = 1 | ||
# fmt: on | ||
|
||
# fmt: off reason | ||
x = 1 | ||
# fmt: on | ||
|
||
# fmt: off | ||
x = 1 | ||
# fmt: on reason | ||
|
||
# fmt: off reason | ||
x = 1 | ||
# fmt: on reason | ||
|
||
# fmt: off - reason | ||
x = 1 | ||
# fmt: on | ||
|
||
# fmt: off | ||
x = 1 | ||
# fmt: on - reason |
3 changes: 3 additions & 0 deletions
3
crates/ruff_python_formatter/resources/test/fixtures/ruff/fmt_skip/reason.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,3 @@ | ||
x = 1 # fmt: skip | ||
x = 1 # fmt: skip reason | ||
x = 1 # fmt: skip - reason |
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
68 changes: 68 additions & 0 deletions
68
crates/ruff_python_formatter/tests/snapshots/format@fmt_on_off__reason.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,68 @@ | ||
--- | ||
source: crates/ruff_python_formatter/tests/fixtures.rs | ||
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/fmt_on_off/reason.py | ||
--- | ||
## Input | ||
```python | ||
# fmt: off | ||
x = 1 | ||
# fmt: on | ||
# fmt: off reason | ||
x = 1 | ||
# fmt: on | ||
# fmt: off reason | ||
x = 1 | ||
# fmt: on | ||
# fmt: off | ||
x = 1 | ||
# fmt: on reason | ||
# fmt: off reason | ||
x = 1 | ||
# fmt: on reason | ||
# fmt: off - reason | ||
x = 1 | ||
# fmt: on | ||
# fmt: off | ||
x = 1 | ||
# fmt: on - reason | ||
``` | ||
|
||
## Output | ||
```python | ||
# fmt: off | ||
x = 1 | ||
# fmt: on | ||
# fmt: off reason | ||
x = 1 | ||
# fmt: on | ||
# fmt: off reason | ||
x = 1 | ||
# fmt: on | ||
# fmt: off | ||
x = 1 | ||
# fmt: on reason | ||
# fmt: off reason | ||
x = 1 | ||
# fmt: on reason | ||
# fmt: off - reason | ||
x = 1 | ||
# fmt: on | ||
# fmt: off | ||
x = 1 | ||
# fmt: on - reason | ||
``` | ||
|
||
|
||
|
20 changes: 20 additions & 0 deletions
20
crates/ruff_python_formatter/tests/snapshots/format@fmt_skip__reason.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,20 @@ | ||
--- | ||
source: crates/ruff_python_formatter/tests/fixtures.rs | ||
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/fmt_skip/reason.py | ||
--- | ||
## Input | ||
```python | ||
x = 1 # fmt: skip | ||
x = 1 # fmt: skip reason | ||
x = 1 # fmt: skip - reason | ||
``` | ||
|
||
## Output | ||
```python | ||
x = 1 # fmt: skip | ||
x = 1 # fmt: skip reason | ||
x = 1 # fmt: skip - reason | ||
``` | ||
|
||
|
||
|