google / google/yapf

Option to `SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED` even when there is only one argument

Open
#315 3 comments 2 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
14k
Forks
904
PR merge metrics
No merged PRs in 30d

Description

Right now we have this current format behavior:

``` python
foo(a=1, b=2,)
foo(a=1,)

# formats to:

foo(
a=1,
b=2,
)
foo(a=1,)
```

i.e., `foo(a=1,)` stays as is because there is only one comma in that line. I'd like an option to indent that, making the final behavior:

``` python
foo(a=1, b=2,)
foo(a=1,)

# formats to:

foo(
a=1,
b=2,
)
foo(
a=1,
)
```

Current behavior seems to be intentional and hardcoded into `pytree_unwrapper._DetermineMustSplitAnnotation`

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.