Skip to content

Commit

Permalink
Fix coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
xcatliu committed Dec 5, 2017
1 parent 7f62d65 commit a3fa2b6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/ComplexityChecker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ class ComplexityChecker extends BaseChecker {
return {
filepath: resolvedFilepath,
complexity: 0,
details: []
details: [],
numberOfFunctions: 0,
numberOfHighComplexityFunctions: 0
};
}

Expand Down Expand Up @@ -109,14 +111,6 @@ class ComplexityChecker extends BaseChecker {
}
return 0;
}
getPercentage(count) {
let result = 0;
if (this.fileList.length > 0) {
result = count / this.fileList.length * 100;
}
result = result.toFixed(2);
return result;
}
}

module.exports = ComplexityChecker;
16 changes: 16 additions & 0 deletions test/integration/checkUnsupportedFiletype.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const assert = require('chai').assert;

const CodeQualityChecker = require('../../');
const codeQualityChecker = new CodeQualityChecker();

describe('Check unsupported filetype', () => {
const cqcResult = codeQualityChecker.check([
'test/sample/hello.java'
]);
it('should have correct result', () => {
assert.equal(cqcResult.base.numberOfFiles, 1);
assert.equal(cqcResult.sloc.source, 5);
assert.equal(cqcResult.jscpd.percentage, '0.00');
assert.equal(cqcResult.complexity.percentage, '0.00');
});
});
8 changes: 8 additions & 0 deletions test/sample/hello.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
public class HelloWorld {

public static void main(String[] args) {
// Prints "Hello, World" to the terminal window.
System.out.println("Hello, World");
}

}

0 comments on commit a3fa2b6

Please sign in to comment.