google / google/yapf

Fails to apply `split_before_first_argument` on complex function call

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

Description

Formatting some input like this

```
def blerp():
outerfun(xxxxx_arg0, innerfun(xxxxx_arg1, evenmoreinner(xxxxx_arg2)['lookup']))
```

produces
```
def blerp():
outerfun(
xxxxx_arg0, innerfun(xxxxx_arg1,
evenmoreinner(xxxxx_arg2)['lookup']))
```

Where the arguments to innerfun are formatted with a hanging indent and not breaking before arg1, and additionally would even fit on a line by itself.

I've been igging through the code and this is because the check at L214 only does FitsOnLine while on L406 some additional terms are added. I don't really get what those are trying to do and removing them fixes *my* problem and the only test breaking actually looks better *imho*

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.