mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 05:26:23 +00:00
Fix incorect placement of trailing stub function comments (#11632)
This commit is contained in:
parent
889667ad84
commit
9b6d2ce1f2
6 changed files with 142 additions and 44 deletions
|
@ -0,0 +1,77 @@
|
|||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/stub_functions_trailing_comments.py
|
||||
---
|
||||
## Input
|
||||
```python
|
||||
# Regression tests for https://github.com/astral-sh/ruff/issues/11569
|
||||
|
||||
|
||||
# comment 1
|
||||
def foo(self) -> None: ...
|
||||
def bar(self) -> None: ...
|
||||
# comment 2
|
||||
|
||||
# comment 3
|
||||
def baz(self) -> None:
|
||||
return None
|
||||
# comment 4
|
||||
|
||||
|
||||
def foo(self) -> None: ...
|
||||
# comment 5
|
||||
|
||||
def baz(self) -> None:
|
||||
return None
|
||||
|
||||
|
||||
def foo(self) -> None:
|
||||
... # comment 5
|
||||
def baz(self) -> None:
|
||||
return None
|
||||
|
||||
def foo(self) -> None: ...
|
||||
# comment 5
|
||||
```
|
||||
|
||||
## Output
|
||||
```python
|
||||
# Regression tests for https://github.com/astral-sh/ruff/issues/11569
|
||||
|
||||
|
||||
# comment 1
|
||||
def foo(self) -> None: ...
|
||||
def bar(self) -> None: ...
|
||||
|
||||
|
||||
# comment 2
|
||||
|
||||
|
||||
# comment 3
|
||||
def baz(self) -> None:
|
||||
return None
|
||||
|
||||
|
||||
# comment 4
|
||||
|
||||
|
||||
def foo(self) -> None: ...
|
||||
|
||||
|
||||
# comment 5
|
||||
|
||||
|
||||
def baz(self) -> None:
|
||||
return None
|
||||
|
||||
|
||||
def foo(self) -> None: ... # comment 5
|
||||
def baz(self) -> None:
|
||||
return None
|
||||
|
||||
|
||||
def foo(self) -> None: ...
|
||||
|
||||
|
||||
# comment 5
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue