google / google/yapf

SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED can not handle inline comments

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

Description

When the option SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED is activated

the following would not be processable:

```
dict(a=1, b=2, # this can not be processed because of this comment
c=3,
)
```

it should be converted to
```
dict(
a=1,
b=2, # this comment can not be processed
c=3,
)
```

instead it is left as is.

If one omits the last comma the dictionary will be processed as expected. (option is not triggered?)

If the comment is added to the last line, the output is as expected.

If the comment is put into a separate line, the output is as expected as well.

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.