YAPF skipped formatting for comment in the middle of the function body
- Dominant language
- Python
- Stars
- 14k
- Forks
- 904
- PR merge metrics
- No merged PRs in 30d
Description
Hi.
Thanks for your great tool.
When I tried to format the code below:
```python
def foo(a, b, c):
if a is None:
a = bar()
else:
a += zar()
# Comment that would not be not formatted
b = a
# Comment that will be formatted
c = baz(a, b)
return True
```
The result is strange: as the comments are saying themselves, the first comment above the `b = a` is **not formatted** while the second comment below `b = a` is formatted.
```python
def foo(a, b, c):
if a is None:
a = bar()
else:
a += zar()
# Comment that would not be not formatted
b = a
# Comment that will be formatted
c = baz(a, b)
return True
```
The same issue happens for version 0.26.0 and 0.27.0.
Could you check this issue please? Thank you!
Contributor guide
Assessment
This issue has not been assessed yet.