yapf icon indicating copy to clipboard operation
yapf copied to clipboard

SPLIT_BEFORE_FIRST_ARGUMENT should be respected when SPLIT_COMPLEX_COMPREHENSION causes the split.

Open Aplietexe opened this issue 2 years ago • 0 comments

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:


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


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

Aplietexe avatar Dec 07 '22 10:12 Aplietexe