mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 05:25:17 +00:00
Avoid unstable formatting in ellipsis-only body with trailing comment (#8984)
## Summary We should avoid inlining the ellipsis in: ```python def h(): ... # bye ``` Just as we omit the ellipsis in: ```python def h(): # bye ... ``` Closes https://github.com/astral-sh/ruff/issues/8905.
This commit is contained in:
parent
bfae1f1412
commit
6fe8f8a272
3 changed files with 18 additions and 3 deletions
|
@ -74,6 +74,10 @@ with True:
|
|||
with True:
|
||||
... # comment
|
||||
|
||||
with True:
|
||||
...
|
||||
# comment
|
||||
|
||||
match x:
|
||||
case 1:
|
||||
...
|
||||
|
@ -105,7 +109,8 @@ try:
|
|||
except:
|
||||
... # comment
|
||||
finally:
|
||||
... # comment```
|
||||
... # comment
|
||||
```
|
||||
|
||||
## Output
|
||||
```python
|
||||
|
@ -163,6 +168,10 @@ with True:
|
|||
|
||||
with True: ... # comment
|
||||
|
||||
with True:
|
||||
...
|
||||
# comment
|
||||
|
||||
match x:
|
||||
case 1: ...
|
||||
case 2:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue