[Not maintained] JS cyclomatic complexity report generator
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
bin [clean] Remove useless verbose mode Dec 9, 2014
src add function count Mar 1, 2016
test fix tests Mar 2, 2016
.gitignore Fixing code syntax and validation task output, incrementing tag Jan 24, 2014
.travis.yml Adding travis conf Jan 23, 2014
Gruntfile.js [task] Simplify gruntfile tasks Dec 9, 2014
README.md [doc] Update doc accordingly to options changes Dec 12, 2014
index.js [api change] Expose the 'analyse' function Dec 10, 2014
package.json Update outdated dependencies Mar 6, 2016
sample.js [api change] Expose the 'analyse' function Dec 10, 2014



JS cyclomatic complexity report generator.

Command-line tool and module that generates a report of Javascript files complexity. It is based on escomplex module's results.

In 'html' mode, command-line tool will create an .html file report containing graphical representation of files complexity and lines of code count.

Build Status


npm install -g jscomplexity

###Module usage

var jscomplexity = require('jscomplexity');

// jscomplexity() returns a promise (using bluebird)
jscomplexity('/glob/pattern/to/js/*' [, globOptions]).then(console.log);

// you can also use CPS style
jscomplexity('/glob/pattern/to/js/*', {}, function(err, result){
  if(err) {
    return console.log(err);

###Command-line usage

Usage: jscomplexity [options]


    -h, --help                 output usage information
    -V, --version              output the version number
    -p, --pattern <pattern>    glob pattern - default is current directory
    -o, --output <filename>    (optional) customize html report filename - default is 'jscomplexity-report.html'
    -r, --reporter <reporter>  (optional) specify a reporter: 'terminal', 'html' or 'all' - default is 'terminal'

⚠️ Linux/OSX compliant only (I haven't tested it on Windows).

CLI Example : jscomplexity -p '{src/*.js,src/**/*.js,!src/config/**}'

Sample outputs (gremlins.js)


alt tag

HTML report

alt tag

Grunt task

See grunt-jscomplexity-threshold module.