Menu

#617 nl_if_leave_one_liners should be independent of nl_if_brace

Future
works-for-me
nobody
None
C/C++
5
2016-03-22
2015-01-22
Sean Ahern
No

If there is a one liner if() statement without brackets and I have nl_if_leave_one_liners = false, it doesn't add a line break unless nl_if_brace=true. These configuration options should be independent of each other. I never want to see one-liner code and always want the conditional broken from the statements. But if braces are around, I want the braces on the same line as the if.

Thus, nl_if_leave_one_liners=false and nl_if_brace=false should give this:

if (a) b++;

should become:

if (a)
b++;

and:

if (a) { b++; }

should become:

if (a) {
b++;
}

(This is related to bug 291: http://sourceforge.net/p/uncrustify/bugs/291/)

Discussion

  • Sean Ahern

    Sean Ahern - 2015-01-23

    This is with version 0.61.

     
  • Guy Maurel

    Guy Maurel - 2016-03-17

    The option:
    nl_if_leave_one_liners = true

    is stronger as the option:
    nl_if_brace = force

     
  • Guy Maurel

    Guy Maurel - 2016-03-22
     
  • Guy Maurel

    Guy Maurel - 2016-03-22

    The option:
    nl_if_leave_one_liners = true

    is stronger as the option:
    nl_if_brace = force

     
  • Guy Maurel

    Guy Maurel - 2016-03-22
    • status: open --> works-for-me