google / google/yapf

Knob to force argument splitting in dict even not comma terminated

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

Description

With `SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED=true` the following formatting occurs:

```
responseDict = {
"timestamp": timestamp,
"someValue": value,
"whatever": 120
}

responseDict = {
"timestamp": timestamp,
"someValue": value,
"whatever": 120,
}
```

to:

```
responseDict = {"timestamp": timestamp, "someValue": value, "whatever": 120}

responseDict = {
"timestamp": timestamp,
"someValue": value,
"whatever": 120,
}
```

I'd like to have the knob to keep short dicts with argument splitting (i.e. not join to one line) even if they don't end with a comma:

```
responseDict = {
"timestamp": timestamp,
"someValue": value,
"whatever": 120
}

responseDict = {
"timestamp": timestamp,
"someValue": value,
"whatever": 120,
}
```

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.