google / google/yapf

Inconsistent splitting of long function parameter lists

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

Description

Hi everyone,

thanks for the great tool! Quick question. Below I have 2 too long function calls of `plt.plot`. The first call contains function calls itself, the latter variable names. Why are they split differently? Is there a way to enforce consistent behavior?

Thanks a lot
Florian
# Config
```
[style]
based_on_style = pep8
split_before_first_argument = False
split_before_named_assigns = False
```
# Code
``` python
# Original code
plt.plot(numpy.linspace(0, 1, 10), numpy.linspace(0, 1, 10), marker="x", color="r")

plt.plot(veryverylongvariablename, veryverylongvariablename, marker="x", color="r")

# Formatted with YAPF
plt.plot(
numpy.linspace(0, 1, 10), numpy.linspace(0, 1, 10), marker="x", color="r")

plt.plot(veryverylongvariablename, veryverylongvariablename, marker="x",
color="r")

# Expected / desired output
plt.plot(numpy.linspace(0, 1, 10), numpy.linspace(0, 1, 10), marker="x",
color="r")

plt.plot(veryverylongvariablename, veryverylongvariablename, marker="x",
color="r")
```

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.