yapf indents long with statements too aggressively when wrapped with ()s
- Dominant language
- Python
- Stars
- 14k
- Forks
- 904
- PR merge metrics
- No merged PRs in 30d
Description
Here's what I'm seeing:
```
def createTestInstance():
with mock.patch('SomeLongStringHere1SomeLongStringHere1') as a, (
mock.patch('SomeLongStringHere2SomeLongStringHere1')) as b, (
mock.patch('SomeLongStringHere2SomeLongStringHere1')) as c, (
mock.patch('SomeLongStringHere2SomeLongStringHere1')) as d, (
mock.patch('SomeLongStringHere3SomeLongStringHere1')) as e:
pass
```
Turns into:
```
def example():
with mock.patch('SomeLongStringHere1SomeLongStringHere1') as a, (
mock.patch('SomeLongStringHere2SomeLongStringHere1')) as b, (
mock.patch('SomeLongStringHere2SomeLongStringHere1')) as c, (
mock.patch('SomeLongStringHere2SomeLongStringHere1')) as d, (
mock.patch('SomeLongStringHere3SomeLongStringHere1')) as e:
pass
```
Since the parenthesis are not nested, I wouldn't expect the indent to grow.
Everything is fine when using \ to make newlines:
```
def createTestInstance():
with mock.patch('SomeLongStringHere1SomeLongStringHere1') as a, \
mock.patch('SomeLongStringHere2SomeLongStringHere1') as b, \
mock.patch('SomeLongStringHere2SomeLongStringHere1') as c, \
mock.patch('SomeLongStringHere2SomeLongStringHere1') as d, \
mock.patch('SomeLongStringHere3SomeLongStringHere1') as e:
pass
```
So the work-around is pretty easy. Just thought I'd file this anyways.
Contributor guide
Assessment
This issue has not been assessed yet.