Skip to content

Commit 639821f

Browse files
committed
Merge pull request #6 from tborychowski/patch-1
Add function count
2 parents 4fa36b7 + a66381a commit 639821f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/analyse.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ module.exports = function analyse (fileRef){
3232
path : fileRef,
3333
escapedPath : fileRef.replace(/\\/g, '\\'), // windows use
3434
complexity : report.aggregate.cyclomatic,
35-
lineNumber : report.aggregate.sloc.logical,
35+
lineCount : report.aggregate.sloc.logical,
36+
functionCount : report.functions.length,
3637
maintainability : Math.round(report.aggregate.halstead.effort),
3738
halstead : {
3839
length : report.aggregate.halstead.length,
@@ -46,4 +47,4 @@ module.exports = function analyse (fileRef){
4647

4748
;
4849

49-
};
50+
};

test/expectations/complex-tree-results.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,26 @@
44
"path": "test/fixture/complex/jquery/jquery-2.0.3.js",
55
"escapedPath": "test/fixture/complex/jquery/jquery-2.0.3.js",
66
"complexity": 1468,
7-
"lineNumber": 4432,
7+
"lineCount": 4432,
8+
"functionCount": 551,
89
"maintainability": 84188538,
910
"halstead": { "length": 28743, "vocabulary": 1648, "difficulty": 274, "bugs": 102 }
1011
},
1112
{
1213
"path": "test/fixture/complex/jquery/min/jquery-2.0.3.min.js",
1314
"escapedPath": "test/fixture/complex/jquery/min/jquery-2.0.3.min.js",
1415
"complexity": 1195,
15-
"lineNumber": 2825,
16+
"lineCount": 2825,
17+
"functionCount": 551,
1618
"maintainability": 104949018,
1719
"halstead": { "length": 28696, "vocabulary": 1262, "difficulty": 355, "bugs": 99 }
1820
},
1921
{
2022
"path": "test/fixture/complex/empty.js",
2123
"escapedPath": "test/fixture/complex/empty.js",
2224
"complexity": 1,
23-
"lineNumber": 0,
25+
"lineCount": 0,
26+
"functionCount": 0,
2427
"maintainability": 0,
2528
"halstead": { "length": 0, "vocabulary": 0, "difficulty": 0, "bugs": 0 }
2629
}

0 commit comments

Comments
 (0)