google / google/yapf

Leave single argument with trailing comma on own line

Open
#1,037 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

Right now, I don't believe there's a way to have yapf put a single argument to a function on its own line when there's a trailing comma. For example,
```python
bar = foo(
"only item",
)
```
gets formatted as
```
bar = foo("only item",)
```
whereas I prefer it to remain as-is, given the presence of a trailing comma.

On the other hand, lines such as
```python
bar = foo(
"first item",
"second item",
)
```
are left alone, as desired.

Have I missed a config setting for this behaviour, or is this feature not yet implemented?

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.