google / google/yapf

Dictionary comments are oddly and inconsistently indented with SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES

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

Description

Reproducible example:

```python
table = {
# Description #1
"foo": "lorem ipsum dolor est",

# Description #2
"bar": "lorem ipsum dolor est",

# Description #2
"baz": "lorem ipsum dolor est",
}
```
with a `.style.yapf` file:
```
[style]
SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES = True
```
running `yapf --diff` (0.31.0) outputs:
```
@@ -2,9 +2,9 @@
# Description #1
"foo": "lorem ipsum dolor est",

- # Description #2
+ # Description #2
"bar": "lorem ipsum dolor est",

- # Description #2
+ # Description #2
"baz": "lorem ipsum dolor est",
}
```
The first comment was left alone, but the subsequent comments were inexplicably(?) unindented by two spaces.

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.