Yapf: Split arguments into separate lines if they're multiline

Created on 1 Oct 2017  路  3Comments  路  Source: google/yapf

I've some function calls where arguments don't fit a single line:

  some_function(some_value, some_value, some_value, some_value, some_value,
              some_value)

For cases such as these, I'd prefer to always split each argument into a separate line (I feel that this is extremely common):

some_function(
    some_value,
    some_value,
    some_value,
    some_value,
    some_value,
    some_value)

This is currently not possible. The closest thing is SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED, but that only applies if there's a trailing comma. In my case, I don't want to depend on the comma, but rather of whether the arguments fit in a single line or not.

enhancement

Most helpful comment

I have the exact same problem. I get this code:

some.Object.whatever.function(
    some_value, some_value, some_value
)

Which is annoying. If YAPF is going to split that, I want it to always split into multiple lines.

All 3 comments

I have the exact same problem. I get this code:

some.Object.whatever.function(
    some_value, some_value, some_value
)

Which is annoying. If YAPF is going to split that, I want it to always split into multiple lines.

@decentral1se I think that update does not apply to function calls like in the main issue? I'm experiencing the same problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jamesqo picture jamesqo  路  5Comments

pankdm picture pankdm  路  8Comments

advance512 picture advance512  路  6Comments

tschijnmo picture tschijnmo  路  6Comments

eli-schwartz picture eli-schwartz  路  5Comments