Closed cyw3 closed 4 years ago
@terryyin Please take a look at this question.
Case 1: Test Code
//
// TestLizard.m
#import "TestLizard.h"
typedef void(^alertActionHandler)(void);
@implementation TestLizard
- (void)method1 {
}
- (void)method2 {
}
- (void)method3 {
}
@end
Result:
================================================
NLOC CCN token PARAM length location
------------------------------------------------
3 1 8 1 4 TestLizard@5-8@/Users/kingsword/Desktop/CommandLineTest/CommandLineTest/TestLizard.m
1 file analyzed.
==============================================================
NLOC Avg.NLOC AvgCCN Avg.token function_cnt file
--------------------------------------------------------------
9 3.0 1.0 8.0 1 /Users/kingsword/Desktop/CommandLineTest/CommandLineTest/TestLizard.m
===============================================================================================================
No thresholds exceeded (cyclomatic_complexity > 15 or nloc > 1000000 or length > 1000 or parameter_count > 100)
==========================================================================================
Total nloc Avg.NLOC AvgCCN Avg.token Fun Cnt Warning cnt Fun Rt nloc Rt
------------------------------------------------------------------------------------------
9 3.0 1.0 8.0 1 0 0.00 0.00
but when I comment "typedef void(^alertActionHandler)(void);" in line 4
//
// TestLizard.m
#import "TestLizard.h"
//typedef void(^alertActionHandler)(void);
@implementation TestLizard
- (void)method1 {
}
- (void)method2 {
}
- (void)method3 {
}
@end
Result is right。
================================================
NLOC CCN token PARAM length location
------------------------------------------------
2 1 3 0 3 method1@6-8@/Users/kingsword/Desktop/CommandLineTest/CommandLineTest/TestLizard.m
2 1 3 0 3 method2@10-12@/Users/kingsword/Desktop/CommandLineTest/CommandLineTest/TestLizard.m
2 1 3 0 3 method3@14-16@/Users/kingsword/Desktop/CommandLineTest/CommandLineTest/TestLizard.m
1 file analyzed.
==============================================================
NLOC Avg.NLOC AvgCCN Avg.token function_cnt file
--------------------------------------------------------------
8 2.0 1.0 3.0 3 /Users/kingsword/Desktop/CommandLineTest/CommandLineTest/TestLizard.m
===============================================================================================================
No thresholds exceeded (cyclomatic_complexity > 15 or nloc > 1000000 or length > 1000 or parameter_count > 100)
==========================================================================================
Total nloc Avg.NLOC AvgCCN Avg.token Fun Cnt Warning cnt Fun Rt nloc Rt
------------------------------------------------------------------------------------------
8 2.0 1.0 3.0 3 0 0.00 0.00
Case 2: Test Code
//
// TestLizard.m
#import "TestLizard.h"
typedef NS_ENUM(NSUInteger, TRMemoCellType) {
TRMemoCellTypeHome = 0,
TRMemoCellTypeSearch = 1,
TRMemoCellTypeVoiceMemo = 2,
};
@implementation TestLizard
- (void)method1 {
}
- (void)method2 {
}
- (void)method3 {
}
@end
Result
================================================
NLOC CCN token PARAM length location
------------------------------------------------
5 1 20 2 5 NS_ENUM@4-8@/Users/kingsword/Desktop/CommandLineTest/CommandLineTest/TestLizard.m
2 1 3 0 3 method1@10-12@/Users/kingsword/Desktop/CommandLineTest/CommandLineTest/TestLizard.m
2 1 3 0 3 method2@14-16@/Users/kingsword/Desktop/CommandLineTest/CommandLineTest/TestLizard.m
2 1 3 0 3 method3@18-20@/Users/kingsword/Desktop/CommandLineTest/CommandLineTest/TestLizard.m
1 file analyzed.
==============================================================
NLOC Avg.NLOC AvgCCN Avg.token function_cnt file
--------------------------------------------------------------
13 2.8 1.0 7.2 4 /Users/kingsword/Desktop/CommandLineTest/CommandLineTest/TestLizard.m
===============================================================================================================
No thresholds exceeded (cyclomatic_complexity > 15 or nloc > 1000000 or length > 1000 or parameter_count > 100)
==========================================================================================
Total nloc Avg.NLOC AvgCCN Avg.token Fun Cnt Warning cnt Fun Rt nloc Rt
------------------------------------------------------------------------------------------
13 2.8 1.0 7.2 4 0 0.00 0.00
”NS_ENUM@4-8@...“ in line 4 is not a function,but counted.
case one fixed and passing: https://github.com/terryyin/lizard/commit/06a26064796b16f55bfd3e4b89b2ef94598b30c1
oh, case 2 also pass.
Thanks!
output is:
And if I remove the "typedef void (componentEventFunc)(id, SEL, NSDictionary , id);" from the code file, lizard works and output is: