google / google/yapf

SPLIT_BEFORE_FIRST_ARGUMENT should be respected when SPLIT_COMPLEX_COMPREHENSION causes the split.

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

Description

Given this .style.yapf
```

[style]
based_on_style = google
split_before_first_argument = True
split_arguments_when_comma_terminated = True
coalesce_brackets = True

```

currently yapf formats this code like this:
```python

total_food_per_elf = [
sum(int(food)
for food in foods.split('\n'))
for foods in input_text.split('\n\n')
]

```

But according to the description of the SPLIT_BEFORE_FIRST_ARGUMENT, "If an argument / parameter list is going to be split, then split before the first argument.", the result should be
```python

total_food_per_elf = [
sum(
int(food)
for food in foods.split('\n')
)
for foods in input_text.split('\n\n')
]

```

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.