google / google/yapf

Different formatting depending number of argument to a function

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

Description

I noticed, that with version 0.6.2, when a the first parameter for a function (here: `other_function`) does not take arguments, yapf prints what I would expect:

```
$ echo 'something = a_function(other_function(), some_more_long_arguments, and_more_long_args)' | yapf
something = a_function(other_function(), some_more_long_arguments,
and_more_long_args)
```

However, if `other_function` has an argument, something strange happens:

```
$ echo 'something = a_function(other_function(a), some_more_long_arguments, and_more_long_args)' | yapf
something = a_function(
other_function(a), some_more_long_arguments, and_more_long_args)
```

Is it a bug, or a feature?
Some code formatted in October (that is: some earlier version of yapf) was formatted as the first fragment, even though it used `other_function(a)` like construct.

This seems related to #216
Is it possible to control how this works?

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.