smile
(lmy690043305)
September 18, 2018, 7:57am
1
(void)initMyScrollViewContentView{
self.myScrollViewContentView = [[UIView alloc] initWithFrame:CGRectZero];
self.myScrollViewContentView.backgroundColor = RGBCOLOR(0xff, 0xff, 0xff);
[self.myScrollView addSubview:self.myScrollViewContentView];
[self.myScrollViewContentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.myScrollView);
make.width.mas_equalTo(self.myScrollView);
make.height.mas_equalTo(ScreenHeight-kNavBar_H-kBottomSafeArea_H-50+self.headerHeight);
}];
}
#define RGBCOLOR(r,g,b) ([UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1])
Expected Behavior
Cyclomatic Complexity Number is 2
Actual Behavior
Cyclomatic Complexity Number 25 exceeds limit of 10
ganncamp
(G Ann Campbell)
September 18, 2018, 4:18pm
2
Hi,
It’s not clear to me what language this is. Also, you should be seeing secondary locations indicating where the complexity is incremented. Could you edit your post to add those to the code sample?
Thx,
Ann
smile
(lmy690043305)
September 19, 2018, 2:16am
3
smile:
mas_equalTo
This is the Object-C code, After we expand the definition of macros, we find that the complexity of loops is very high indeed.
- (void)initMyScrollViewContentView{
self.myScrollViewContentView = [[UIView alloc] initWithFrame:CGRectZero];
self.myScrollViewContentView.backgroundColor = ([UIColor colorWithRed:(0xff)/255.0 green:(0xff)/255.0 blue:(0xff)/255.0 alpha:1]);
[self.myScrollView addSubview:self.myScrollViewContentView];
[self.myScrollViewContentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(_MASBoxValue(@encode(__typeof__(((self.myScrollView)))), ((self.myScrollView))));
make.width.equalTo(_MASBoxValue(@encode(__typeof__(((self.myScrollView)))), ((self.myScrollView))));
make.height.equalTo(_MASBoxValue(@encode(__typeof__((([UIScreen mainScreen].bounds.size.height-(((UIScreen.mainScreen.currentMode.size.width == 1125 && UIScreen.mainScreen.currentMode.size.height == 2436) || (UIScreen.mainScreen.currentMode.size.width == 750 && UIScreen.mainScreen.currentMode.size.height == 1624) || (UIScreen.mainScreen.currentMode.size.width == 1125 && UIScreen.mainScreen.currentMode.size.height == 2436)) ? 88 : 64)-(((UIScreen.mainScreen.currentMode.size.width == 1125 && UIScreen.mainScreen.currentMode.size.height == 2436) || (UIScreen.mainScreen.currentMode.size.width == 750 && UIScreen.mainScreen.currentMode.size.height == 1624) || (UIScreen.mainScreen.currentMode.size.width == 1125 && UIScreen.mainScreen.currentMode.size.height == 2436)) ? 34 : 0.0)-50+self.headerHeight)))), (([UIScreen mainScreen].bounds.size.height-(((UIScreen.mainScreen.currentMode.size.width == 1125 && UIScreen.mainScreen.currentMode.size.height == 2436) || (UIScreen.mainScreen.currentMode.size.width == 750 && UIScreen.mainScreen.currentMode.size.height == 1624) || (UIScreen.mainScreen.currentMode.size.width == 1125 && UIScreen.mainScreen.currentMode.size.height == 2436)) ? 88 : 64)-(((UIScreen.mainScreen.currentMode.size.width == 1125 && UIScreen.mainScreen.currentMode.size.height == 2436) || (UIScreen.mainScreen.currentMode.size.width == 750 && UIScreen.mainScreen.currentMode.size.height == 1624) || (UIScreen.mainScreen.currentMode.size.width == 1125 && UIScreen.mainScreen.currentMode.size.height == 2436)) ? 34 : 0.0)-50+self.headerHeight))));
}];
}
thanks a lot this problem has been closed
1 Like