diff --git a/src/ComplexityChecker/index.js b/src/ComplexityChecker/index.js index 942252d..3722227 100644 --- a/src/ComplexityChecker/index.js +++ b/src/ComplexityChecker/index.js @@ -71,7 +71,9 @@ class ComplexityChecker extends BaseChecker { return { filepath: resolvedFilepath, complexity: 0, - details: [] + details: [], + numberOfFunctions: 0, + numberOfHighComplexityFunctions: 0 }; } @@ -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; diff --git a/test/integration/checkUnsupportedFiletype.test.js b/test/integration/checkUnsupportedFiletype.test.js new file mode 100644 index 0000000..428489f --- /dev/null +++ b/test/integration/checkUnsupportedFiletype.test.js @@ -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'); + }); +}); diff --git a/test/sample/hello.java b/test/sample/hello.java new file mode 100644 index 0000000..6634e98 --- /dev/null +++ b/test/sample/hello.java @@ -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"); + } + +} \ No newline at end of file