Skip to content

Commit 011b3a5

Browse files
committed
fix stacktraces in CyclomaticComplexityCheck
1 parent a7ec229 commit 011b3a5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

checkstyle/checks/CyclomaticComplexityCheck.hx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ using Lambda;
1313
@desc("McCabe simplified cyclomatic complexity check")
1414
class CyclomaticComplexityCheck extends Check {
1515

16-
public var thresholds:Array<Threshold>;
16+
public var thresholds:Array<Threshold> = [];
1717

1818
override function _actualRun() {
1919
_checker.ast.decls.map(function(type:TypeDecl):Null<Definition<ClassFlag, Array<Field>>> {
@@ -99,6 +99,7 @@ class CyclomaticComplexityCheck extends Check {
9999
case ExprDef.EDisplay(e, _) : evaluateExpr(e);
100100
case ExprDef.ETernary(econd, eif, eelse) : 1 + evaluateExpr(econd) + evaluateExpr(eif) + evaluateExpr(eelse);
101101
case ExprDef.ECheckType(e, _) : evaluateExpr(e);
102+
case null: 0;
102103
default: 0;
103104
}
104105
}
@@ -116,4 +117,4 @@ typedef Target = {
116117
typedef Threshold = {
117118
var severity:String;
118119
var complexity:Int;
119-
}
120+
}

0 commit comments

Comments
 (0)