google / google/yapf

Google formatting change

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

Description

It looks like the default google formatting has changed, and I can't see a way to revert back to the old formatting provided by YAPF.
If I have a really long function definition like this:

```
def a_very_long_function_name(long_argument_name_1=1, long_argument_name_2=2, long_argument_name_3=3, long_argument_name_4=4):
```

I would like it to be formatted like this:
```
def a_very_long_function_name(long_argument_name_1=1,
long_argument_name_2=2,
long_argument_name_3=3,
long_argument_name_4=4,
):
```

Looking at previous issues from back in 2016, the default formatting seems to be the one I need, but that doesn't seem to be the case now. Instead I end up with something like this:
```
def a_very_long_function_name(
long_argument_name_1=1,
long_argument_name_2=2,
long_argument_name_3=3,
long_argument_name_4=4):
```

I've tried setting SPLIT_BEFORE_FIRST_ARGUMENT, SPLIT_BEFORE_NAMED_ASSIGNS, and DEDENT_CLOSING_BRACKETS all to False, but it doesn't seem to make any difference. I'm confident that I am passing the arguments in correctly as I can set `column_limit = 30` and see a significant difference in the output.

Is there something I am missing here?

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.