terryyin / lizard

A simple code complexity analyser without caring about the C/C++ header files or Java imports, supports most of the popular languages.
Other
1.85k stars 250 forks source link

Fail to recognize the function in .mm file #286

Closed cyw3 closed 4 years ago

cyw3 commented 4 years ago
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wbuiltin-macro-redefined"
#undef __FILE__
#define __FILE__ "demo.mm"
#pragma clang diagnostic pop

@interface demo ()

@end

@implementation demo

#if !GRAY_OR_APPSTORE
extern BOOL g_bReasonHidden;
#endif

- (id)init {
    if (self = [super init]) {
        _dateFormatter = [[NSDateFormatter alloc] init];
        [_dateFormatter setDateFormat:@"MM-dd HH:mm"];
        _dateFullFormatter = [[NSDateFormatter alloc] init];
        [_dateFullFormatter setDateFormat:@"yy-MM-dd HH:mm"];
        _hourMinFormatter = [[NSDateFormatter alloc] init];
        [_hourMinFormatter setDateFormat:@"HH:mm"];

#if !GRAY_OR_APPSTORE
        NSString *reason = getSettingValueWithKey(@"open_reason");
        g_bReasonHidden = !([reason intValue] > 0);
#endif
        _hasNewStyle = YES;
        _proteusReady = NO;
    }
    return self;
}

@end

output is: 2,1,11,1,3,"if@18-20@/xxx/demo.mm","/xxx/demo.mm","if","if( self = [ super init ])",18,20

So My problems are:

  1. Lizard fail to scan mm files' function?

  2. "if@18-20@/xxx/demo.mm" is not a function.

kingsword commented 4 years ago

I ran into the same problem. any solution?

terryyin commented 4 years ago

Hi @cyw3, sorry for the slow response.

@kingsword thanks for your reminder.

It's fixed now. And the fix was very easy -- .mm file extension wasn't regarded as object-c previously.