From 2b3e97b5a45572fadc07dfd6ffbfbe591af2656a Mon Sep 17 00:00:00 2001 From: Thomas Aylott Date: Tue, 26 Nov 2013 14:56:25 -0500 Subject: [PATCH] NEW `grunt complexity` reporting task --- Gruntfile.js | 3 ++- grunt/config/complexity.js | 9 +++++++++ package.json | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 grunt/config/complexity.js diff --git a/Gruntfile.js b/Gruntfile.js index 3a905b4eaf..b4013a8e66 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -23,7 +23,8 @@ module.exports = function(grunt) { npm: require('./grunt/config/npm'), clean: ['./build', './*.gem', './docs/_site', './examples/shared/*.js', '.module-cache'], jshint: require('./grunt/config/jshint'), - compare_size: require('./grunt/config/compare_size') + compare_size: require('./grunt/config/compare_size'), + complexity: require('./grunt/config/complexity') }); grunt.config.set('compress', require('./grunt/config/compress')); diff --git a/grunt/config/complexity.js b/grunt/config/complexity.js new file mode 100644 index 0000000000..dd5978b7e7 --- /dev/null +++ b/grunt/config/complexity.js @@ -0,0 +1,9 @@ +module.exports.generic = { + src: ['./build/modules/**/*.js'], + options: { + errorsOnly: false, // show only maintainability errors + cyclomatic: 3, + halstead: 8, + maintainability: 100 + } +}; diff --git a/package.json b/package.json index da13f9c317..1619c00653 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,8 @@ "es5-shim": "~2.1.0", "wd": "~0.2.2", "sauce-tunnel": "~1.1.0", - "coverify": "~0.1.1" + "coverify": "~0.1.1", + "grunt-complexity": "~0.1.3" }, "engines": { "node": ">=0.10.0"