google / google/yapf

Prevent double indenting when splitting function parameters in if or with

Open
#982 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
14k
Forks
904
PR merge metrics
No merged PRs in 30d

Description

Hi, is this supported by yapf configuration if I want to prevent the function parameters from being indented twice in this case:

```python
if func(
a,
b,
):
pass
```

Output:

```python
if func(
a,
b,
):
pass
```

Desired output:

```python
if func(
a,
b,
):
pass
```

I can get the output that I want by changing https://github.com/google/yapf/blob/main/yapf/yapflib/format_decision_state.py#L980 from

```python
return token_indent + style.Get('CONTINUATION_INDENT_WIDTH')
```

to

```python
return token_indent
```

But I wonder if this is configurable.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.