-
Notifications
You must be signed in to change notification settings - Fork 943
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
fmt:off
with trailing child comment
- Loading branch information
1 parent
fd07a12
commit 123b4d6
Showing
6 changed files
with
87 additions
and
7 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
.../resources/test/fixtures/ruff/fmt_on_off/fmt_off_unclosed_deep_nested_trailing_comment.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,8 @@ | ||
# Regression test for https://github.com/astral-sh/ruff/issues/8211 | ||
|
||
# fmt: off | ||
from dataclasses import dataclass | ||
|
||
if True: | ||
if False: | ||
x: int # Optional[int] |
8 changes: 8 additions & 0 deletions
8
...on_formatter/resources/test/fixtures/ruff/fmt_on_off/fmt_off_unclosed_trailing_comment.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,8 @@ | ||
# Regression test for https://github.com/astral-sh/ruff/issues/8211 | ||
|
||
# fmt: off | ||
from dataclasses import dataclass | ||
|
||
@dataclass | ||
class A: | ||
x: int # Optional[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
30 changes: 30 additions & 0 deletions
30
.../tests/snapshots/format@fmt_on_off__fmt_off_unclosed_deep_nested_trailing_comment.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,30 @@ | ||
--- | ||
source: crates/ruff_python_formatter/tests/fixtures.rs | ||
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/fmt_on_off/fmt_off_unclosed_deep_nested_trailing_comment.py | ||
--- | ||
## Input | ||
```py | ||
# Regression test for https://github.com/astral-sh/ruff/issues/8211 | ||
# fmt: off | ||
from dataclasses import dataclass | ||
if True: | ||
if False: | ||
x: int # Optional[int] | ||
``` | ||
|
||
## Output | ||
```py | ||
# Regression test for https://github.com/astral-sh/ruff/issues/8211 | ||
# fmt: off | ||
from dataclasses import dataclass | ||
if True: | ||
if False: | ||
x: int # Optional[int] | ||
``` | ||
|
||
|
||
|
30 changes: 30 additions & 0 deletions
30
...on_formatter/tests/snapshots/format@fmt_on_off__fmt_off_unclosed_trailing_comment.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,30 @@ | ||
--- | ||
source: crates/ruff_python_formatter/tests/fixtures.rs | ||
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/fmt_on_off/fmt_off_unclosed_trailing_comment.py | ||
--- | ||
## Input | ||
```py | ||
# Regression test for https://github.com/astral-sh/ruff/issues/8211 | ||
# fmt: off | ||
from dataclasses import dataclass | ||
@dataclass | ||
class A: | ||
x: int # Optional[int] | ||
``` | ||
|
||
## Output | ||
```py | ||
# Regression test for https://github.com/astral-sh/ruff/issues/8211 | ||
# fmt: off | ||
from dataclasses import dataclass | ||
@dataclass | ||
class A: | ||
x: int # Optional[int] | ||
``` | ||
|
||
|
||
|