https://github.com/slyg/jscomplexity
💤 [Not maintained] JS cyclomatic complexity report generator
https://github.com/slyg/jscomplexity
cyclomatic-complexity javascript unmaintained
Last synced: 6 months ago
JSON representation
💤 [Not maintained] JS cyclomatic complexity report generator
- Host: GitHub
- URL: https://github.com/slyg/jscomplexity
- Owner: slyg
- Created: 2013-02-08T13:11:47.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2018-11-28T21:48:25.000Z (over 7 years ago)
- Last Synced: 2025-09-20T02:24:00.025Z (9 months ago)
- Topics: cyclomatic-complexity, javascript, unmaintained
- Language: JavaScript
- Homepage:
- Size: 552 KB
- Stars: 30
- Watchers: 5
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JScomplexity
JS cyclomatic complexity report generator.
Command-line tool and module that generates a report of Javascript files complexity. It is based on [escomplex](https://github.com/philbooth/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.
[](https://travis-ci.org/slyg/jscomplexity)
### Installation
`npm install -g jscomplexity`
### Module usage
```js
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);
}
console.log(result);
});
```
### Command-line usage
```
Usage: jscomplexity [options]
Options:
-h, --help output usage information
-V, --version output the version number
-p, --pattern glob pattern - default is current directory
-o, --output (optional) customize html report filename - default is 'jscomplexity-report.html'
-r, --reporter (optional) specify a reporter: 'terminal', 'html' or 'all' - default is 'terminal'
```
:warning: 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)
#### Terminal

#### HTML report

### Grunt task
See [grunt-jscomplexity-threshold](https://github.com/slyg/grunt-jscomplexity-threshold) module.