Search code examples
objective-cuncrustify

Uncrustify: Remove double and more empty lines in ObjC code


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?


Solution

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

    nl_max = 2