google / google/yapf

SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED doesn't considered?

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

Description

Thank you all for this amazing command! I've beeing using this command in many different project with different rules and styles and it just rocks!

Today, I'm mixing this command with `add-trailing-comma` (https://github.com/asottile/add-trailing-comma) and while testing the run of both I found some strange behaviour in yapf.

It seems that `SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED` is not considered when running:

```diff
$ yapf --diff --style='{based_on_style: pep8, SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED: False}' trailing-example.py
--- trailing-example.py (original)
+++ trailing-example.py (reformatted)
@@ -1,4 +1,22 @@
def myfunc(
- a, b, c, d, e, f, argument, larger, here, to, reach, eighty, lines,
+ a,
+ b,
+ c,
+ d,
+ e,
+ f,
+ argument,
+ larger,
+ here,
+ to,
+ reach,
+ eighty,
+ lines,
):
- a = [1, 2, 3, 4, 5,]
+ a = [
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ ]
$ yapf --version
yapf 0.21.0
```

I supposed that it shouldn't change anything in the above example since it should not split when comman terminated. Am I missing something? Thanks!

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.