2

How can I clean up blocks like the following:

if(a)
{

   foo();

}

into

if(a)
{
   foo();
}
Drew Dormann
  • 59,987
  • 13
  • 123
  • 180
Sam
  • 19,708
  • 4
  • 59
  • 82
  • This might help: [Uncrustify option to leave whitespace on blank lines](http://stackoverflow.com/questions/14297499/uncrustify-option-to-leave-whitespace-on-blank-lines). Looks like it's not supported. – Sumner Evans Mar 07 '15 at 20:27
  • @JoachimPileborg uncrustify is the tool I'm using. – Sam Mar 07 '15 at 21:02
  • How about a regex find and replace to replace \n\n with \n then tell uncrustify where to add new lines? – technosaurus Aug 08 '15 at 06:10

1 Answers1

0

Check these options:

# Whether to remove blank lines after '{'
eat_blanks_after_open_brace     = true    # false/true

# Whether to remove blank lines before '}'
eat_blanks_before_close_brace   = true    # false/true

But some other options such as mod_full_brace_if and nl_if_leave_one_liners can also have an impact. Could convert it to if(a) foo(); for example.

Dave Wood
  • 13,143
  • 2
  • 59
  • 67