yapf: disable region ignored for indented comments
- Dominant language
- Python
- Stars
- 14k
- Forks
- 904
- PR merge metrics
- No merged PRs in 30d
Description
Here's a simple example of the problem. Note that yapf is correctly disabling the rule to add space around binary operators inside the "disable" block, yet it still eats the whitespace at the start of the comments:
```
2*2
# yapf: disable
2*2
2 + 3 # test... going to write a bunch here in this
# long comment block, and I want to preserve
# formatting.
4 + 5 # test 2. Testing...
2+3
# yapf: enable
2+3
```
Yapf produces this result:
```
2 * 2
# yapf: disable
2*2
2 + 3 # test... going to write a bunch here in this
# long comment block, and I want to preserve
# formatting.
4 + 5 # test 2. Testing...
2+3
# yapf: enable
2 + 3
```
I also can't use the "spaces_before_comments" feature on my comments to get around this by aligning them in columns, as I'd like to, because of #675 where it violates the 2-space rule in PEP8 when aligning in columns:
Contributor guide
Assessment
This issue has not been assessed yet.