Skip to content

Commit eebc16e

Browse files
committed
Merge branch 'dev' of github.com:adireddy/haxe-checkstyle into dev
Conflicts: checkstyle/checks/CyclomaticComplexityCheck.hx run.n
2 parents d428a00 + f8d6e2a commit eebc16e

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

checkstyle/checks/CyclomaticComplexityCheck.hx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ 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> = [
17+
{ severity : "WARNING", complexity : 11 },
18+
{ severity : "ERROR", complexity : 21 }
19+
];
1720

1821
override function _actualRun() {
1922
_checker.ast.decls.map(function(type:TypeDecl):Null<Definition<ClassFlag, Array<Field>>> {
@@ -51,10 +54,7 @@ class CyclomaticComplexityCheck extends Check {
5154

5255
// This would not pass the cyclomatic complexity test.
5356
function evaluateExpr(e:Expr):Int {
54-
if (e == null) {
55-
return 0;
56-
}
57-
if (e.expr == null) {
57+
if (e == null || e.expr == null) {
5858
return 0;
5959
}
6060
return switch(e.expr) {

haxelib.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
],
1111
"description": "Automated code analysis ideal for projects that want to enforce a coding standard.",
1212
"contributors": ["adireddy"],
13-
"releasenote": "added NestedIfDepth, NestedForDepth and NestedTryDepth checks by @AlexHaxe",
14-
"version": "1.1.0",
13+
"releasenote": "added Cyclomatic Complexity test by @alebianco",
14+
"version": "1.1.1",
1515
"url": "https://github.com/adireddy/haxe-checkstyle",
1616
"dependencies": {
1717

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "checkstyle",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "Automated code analysis ideal for projects that want to enforce a coding standard.",
55
"repository": {
66
"type": "git",

run.n

126 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)