Chained call indent ever-increasing
- Dominant language
- Python
- Stars
- 14k
- Forks
- 904
- PR merge metrics
- No merged PRs in 30d
Description
I'm having a weird issue where a multi-line chained call is trying to run away. Every time yapf is called it seems to re-indent these lines more and more every time.
Starting with a minimal example
```python
import numpy as np
class YAPFTest:
def __init__(self):
self.moderatleyLongVariable = None
def test_func(self):
self.moderatleyLongVariable = np.array([1]*62) \
.astype('uint8') \
.reshape((31, -1))
```
On the first run both the `.astype` and `.reshape` lines are changed from being indented with tabs to spaces. That makes sense as yapf is looking to do alignment not indentation I imagine. But otherwise the lines, including the alignment of the calls, is unchanged.
```python
def test_func(self):
self.moderatleyLongVariable = np.array([1]*62) \
.astype('uint8') \
.reshape((31, -1))
```
Here's the weird part - if I run it again those two lines double their indent, still consisting of all spaces.
```python
def test_func(self):
self.moderatleyLongVariable = np.array([1]*62) \
.astype('uint8') \
.reshape((31, -1))
```
I can keep doing this; every time I run yapf those two lines jump more and more to the right. That includes going past the column width limit.
My style settings
```ini
[yapf]
USE_TABS = true
ALIGN_CLOSING_BRACKET_WITH_VISUAL_INDENT = true
ARITHMETIC_PRECEDENCE_INDICATION = true
COALESCE_BRACKETS = true
DEDENT_CLOSING_BRACKETS = true
INDENT_WIDTH = 8
```
version: yapf 0.30.0
Contributor guide
Assessment
This issue has not been assessed yet.