google / google/yapf

unwanted split before a function call (in another function call)

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

Description

I wonder what options/knobs are responsible for the different behaviors on the following two statements.
```
r = function(
aaaaaaaaaaaaaa,
bbbbb(b) - cccccc, ddddddddddddddddd, eeee + fffffffffff, gggggggg)
r = function(
aaaaaaaaaaaaaa, bbbbbbbb - cccccc, ddddddddddddddddd, eeee + fffffffffff,
gggggggg)
```
To be specific, I would like the first one to be formatted like the second one, instead of being split before `bbbbb(b)`. It seems that a function call (`bbbbb(b)`) is treated quite differently than a plain variable (`bbbbbbbb`).

The yapf version is 0.31.0, and the options used are
```
[style]
based_on_style = google
split_before_first_argument=True
```

Actually, using "plain" yapf options would also show the unwanted split
```
r = function(aaaaaaaaaaaaaa,
bbbbb(b) - cccccc, ddddddddddddddddd, eeee + fffffffffff,
gggggggg)
r = function(aaaaaaaaaaaaaa, bbbbbbbb - cccccc, ddddddddddddddddd,
eeee + fffffffffff, gggggggg)
```

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.