yapf
yapf copied to clipboard
Split arguments into separate lines if they're multiline
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.
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.
Fix coming in https://github.com/google/yapf/pull/550!
@decentral1se I think that update does not apply to function calls like in the main issue? I'm experiencing the same problem.
Agreed, SPLIT_ALL_COMMA_SEPARATED_VALUES forces always splitting on args, not only if already being split from another rule.