4

I have configured xcode to use Uncrustify to beautify the code. I modified the Uncrustify configuration file and the resulting code is almost as desired.

One thing I don't like is the removal of a blank line between a closing curly brace and the next line of code. For example, this is what Uncrustify currently does:

Input:

if (jsonData != NULL)
{
    return [jsonData objectFromJSONData];
}

NSLog(@"Data read");

Current output:

if (jsonData != NULL)
{
    return [jsonData objectFromJSONData];
}
NSLog(@"Data read");

The desired output would be, in this case, the same as the input:

if (jsonData != NULL)
{
    return [jsonData objectFromJSONData];
}

NSLog(@"Data read");

I already played around with nl_after_func_body = true but this doesn't help.


I now managed to get the behaviour I wanted using the following addition to the configuration file:

nl_before_if = force
nl_after_if = force
nl_before_for = force
nl_after_for = force
nl_before_while = force
nl_after_while = force
nl_before_switch = force
nl_after_switch = force
nl_before_do = force
nl_after_do = force
durron597
  • 31,968
  • 17
  • 99
  • 158
CrossProduct
  • 133
  • 9

2 Answers2

1

Try this:

 nl_after_func_body = 2
Pål Brattberg
  • 4,568
  • 29
  • 40
0

Try using

nl_after_if = add   # ignore/add/remove/force

In your config.

Inspired by: Blank line after curly brace in function with uncrustify

Pablo Oliva
  • 334
  • 3
  • 12