2

So basically I have such code:

NSString *const SomeKey = @"SomeKey";


@implementation SomeClass


- (void)doSomeWork {
    [self startDoingSomeWork];



    [self stopDoingSomeWork];
    [self notifySomeWorkDone];
}

I need this code to be auto-formatted to this form:

NSString *const SomeKey = @"SomeKey";

@implementation SomeClass

- (void)doSomeWork {
    [self startDoingSomeWork];

    [self stopDoingSomeWork];
    [self notifySomeWorkDone];
}

So basically I need to replace all double, triple and etc empty line with single empty line.

Is there any Uncrustify option to enable it?
If No, then do you know any workaround for this scenario?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Vlad Papko
  • 13,184
  • 4
  • 41
  • 57

2 Answers2

4

Finally I found correct option for that.
Just add this line to your configuration file:

nl_max = 2
Vlad Papko
  • 13,184
  • 4
  • 41
  • 57
1

If Uncrustify doesn't support that feature you could try ClangFormat.

MaxEmptyLinesToKeep: 1 will keep at most 1 empty line.

Source: Line breaks between function definitions

Community
  • 1
  • 1
Kevin
  • 16,696
  • 7
  • 51
  • 68