yapf icon indicating copy to clipboard operation
yapf copied to clipboard

SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN appears to still be broken

Open jmlarson1 opened this issue 5 years ago • 2 comments

Although https://github.com/google/yapf/pull/689 fixed some issues with setting SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN = False I am still seeing incorrect formatting that https://github.com/google/yapf/pull/689 should have fixed. I'm using v0.27.0. See the below example of a script where yapf splits after the opening paren:

$ cat test.py 
if True: 
    if True: 
         function(app is not None, "Job must be created with an app -"
                  "no app found for job {}".format(self.id))
$ yapf --style='{based_on_style: pep8, SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN = False}' test.py
if True:
    if True:
        function(
            app is not None, "Job must be created with an app -"
            "no app found for job {}".format(self.id))
$ yapf --version
yapf 0.27.0

Why is function( on its own line?

jmlarson1 avatar Apr 16 '19 01:04 jmlarson1

I got similiar issue with split_before_first_argument:false and SPLIT_COMPLEX_COMPREHENSION=true

dbsxdbsx avatar May 06 '20 03:05 dbsxdbsx

This still exists for yapf version 0.31.0. Notice that function is on its own line, even though split_before_first_argument is false. Any idea why?

jmlarson1 avatar Sep 14 '21 01:09 jmlarson1