mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-16 01:25:22 +00:00
Fix unstable formatting of trailing end-of-line comments of parenthesized attribute values (#16187)
This commit is contained in:
parent
82eae511ca
commit
31180a84e4
4 changed files with 93 additions and 13 deletions
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/attribute.py
|
||||
snapshot_kind: text
|
||||
---
|
||||
## Input
|
||||
```python
|
||||
|
@ -159,6 +158,23 @@ result = (
|
|||
f(111111111111111111111111111111111111111111111111111111111111111111111111111111111)
|
||||
+ 1
|
||||
).bit_length()
|
||||
|
||||
|
||||
# Regression test for https://github.com/astral-sh/ruff/issues/16151
|
||||
result = (
|
||||
(await query_the_thing(mypy_doesnt_understand)) # type: ignore[x]
|
||||
.foo()
|
||||
.bar()
|
||||
)
|
||||
|
||||
(
|
||||
(
|
||||
a # trailing end-of-line
|
||||
# trailing own-line
|
||||
) # trailing closing parentheses
|
||||
# dangling before dot
|
||||
.b # trailing end-of-line
|
||||
)
|
||||
```
|
||||
|
||||
## Output
|
||||
|
@ -295,4 +311,21 @@ result = (
|
|||
f(111111111111111111111111111111111111111111111111111111111111111111111111111111111)
|
||||
+ 1
|
||||
).bit_length()
|
||||
|
||||
|
||||
# Regression test for https://github.com/astral-sh/ruff/issues/16151
|
||||
result = (
|
||||
(await query_the_thing(mypy_doesnt_understand)) # type: ignore[x]
|
||||
.foo()
|
||||
.bar()
|
||||
)
|
||||
|
||||
(
|
||||
(
|
||||
a # trailing end-of-line
|
||||
# trailing own-line
|
||||
) # trailing closing parentheses
|
||||
# dangling before dot
|
||||
.b # trailing end-of-line
|
||||
)
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue