mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-01 20:31:57 +00:00
Break with on end-of-line trailing comments (#7685)
## Summary
Ensures that:
```python
with (
a # comment
):
pass
```
Retains its parentheses.
Closes https://github.com/astral-sh/ruff/issues/6750.
## Test Plan
`cargo test`
This commit is contained in:
parent
58b50a6290
commit
a6d79c03b3
3 changed files with 118 additions and 12 deletions
|
|
@ -114,6 +114,40 @@ with (
|
|||
b # trailing b same line comment
|
||||
): ...
|
||||
|
||||
with (
|
||||
# comment
|
||||
a
|
||||
):
|
||||
pass
|
||||
|
||||
with (
|
||||
a # comment
|
||||
):
|
||||
pass
|
||||
|
||||
with (
|
||||
a
|
||||
# comment
|
||||
):
|
||||
pass
|
||||
|
||||
with (
|
||||
# comment
|
||||
a as b
|
||||
):
|
||||
pass
|
||||
|
||||
with (
|
||||
a as b # comment
|
||||
):
|
||||
pass
|
||||
|
||||
with (
|
||||
a as b
|
||||
# comment
|
||||
):
|
||||
pass
|
||||
|
||||
with (
|
||||
[
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
|
|
@ -297,10 +331,12 @@ with (
|
|||
... # body
|
||||
# body trailing own
|
||||
|
||||
with a as ( # a # as
|
||||
# own line
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
): # b
|
||||
with (
|
||||
a as ( # a # as
|
||||
# own line
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
) # b
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
|
|
@ -372,13 +408,49 @@ with (
|
|||
...
|
||||
|
||||
with (
|
||||
a
|
||||
# trailing own line comment
|
||||
) as ( # trailing as same line comment
|
||||
b
|
||||
): # trailing b same line comment
|
||||
(
|
||||
a
|
||||
# trailing own line comment
|
||||
) as ( # trailing as same line comment
|
||||
b
|
||||
) # trailing b same line comment
|
||||
):
|
||||
...
|
||||
|
||||
with (
|
||||
# comment
|
||||
a
|
||||
):
|
||||
pass
|
||||
|
||||
with (
|
||||
a # comment
|
||||
):
|
||||
pass
|
||||
|
||||
with (
|
||||
a
|
||||
# comment
|
||||
):
|
||||
pass
|
||||
|
||||
with (
|
||||
# comment
|
||||
a as b
|
||||
):
|
||||
pass
|
||||
|
||||
with (
|
||||
a as b # comment
|
||||
):
|
||||
pass
|
||||
|
||||
with (
|
||||
a as b
|
||||
# comment
|
||||
):
|
||||
pass
|
||||
|
||||
with (
|
||||
[
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue