Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prantlf/grunt-escomplex-report
Software complexity analysis for JavaScript projects.
https://github.com/prantlf/grunt-escomplex-report
complexity cyclomatic-complexity grunt-task halstead-complexity maintainability
Last synced: 28 days ago
JSON representation
Software complexity analysis for JavaScript projects.
- Host: GitHub
- URL: https://github.com/prantlf/grunt-escomplex-report
- Owner: prantlf
- License: mit
- Created: 2018-01-29T12:16:51.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-27T12:46:13.000Z (about 5 years ago)
- Last Synced: 2023-12-08T20:02:41.112Z (about 1 year ago)
- Topics: complexity, cyclomatic-complexity, grunt-task, halstead-complexity, maintainability
- Language: JavaScript
- Size: 196 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# grunt-escomplex-report
[![NPM version](https://badge.fury.io/js/grunt-escomplex-report.png)](http://badge.fury.io/js/grunt-escomplex-report)
[![Build Status](https://travis-ci.org/prantlf/grunt-escomplex-report.svg?branch=master)](https://travis-ci.org/prantlf/grunt-escomplex-report)
[![Coverage Status](https://coveralls.io/repos/github/prantlf/grunt-escomplex-report/badge.svg?branch=master)](https://coveralls.io/github/prantlf/grunt-escomplex-report?branch=master)
[![Dependency Status](https://david-dm.org/prantlf/grunt-escomplex-report.svg)](https://david-dm.org/prantlf/grunt-escomplex-report)
[![devDependency Status](https://david-dm.org/prantlf/grunt-escomplex-report/dev-status.svg)](https://david-dm.org/prantlf/grunt-escomplex-report#info=devDependencies)
[![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/)[![NPM Downloads](https://nodei.co/npm/grunt-escomplex-report.png?downloads=true&stars=true)](https://www.npmjs.com/package/grunt-escomplex-report)
Software complexity analysis for JavaScript projects.
# Table of Contents
- [Installation](#installation)
- [Configuration](#configuration)
- [Task Options](#task-options)
- [Task Data](#task-data)
- [Loading](#loading)
- [Build](#build)
- [Contributing](#contributing)
- [Release History](#release-history)
- [License](#license)## Installation
You need [node >= 4][node], [npm] and [grunt >= 0.4.5][Grunt] installed
and your project build managed by a [Gruntfile] with the necessary modules
listed in [package.json]. If you haven't used Grunt before, be sure to check out the [Getting Started] guide, as it
explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this
command:```shell
$ npm install grunt-escomplex-report --save-dev
```## Configuration
Add the `escomplex-report` entry with the task configuration to the options of the `grunt.initConfig` method:
```js
grunt.initConfig({
'escomplex-report': {
all: {
src: ['../../src/**/!(*.spec)+(.js)'],
options: {
output: 'complexity.txt'
}
}
}
});
```Default options support the most usual usage scenario:
```js
'escomplex-report': {
options: {
format: 'plain',
output: null,
onlyfailures: true,
silent: false,
newmi: true,
force: false
},
...
}
```### Task Options
#### force
Type: `Boolean`
Default value: falseIf set to `true`, it suppresses complexity failures. Instead of making the Grunt fail, the errors will be written only to the console.
#### format:
Type: `String`
Default value: nullSpecify the output format of the report.
#### output
Type: `String`
Default value: nullSpecify an output file for the report.
#### ignoreerrors
Type: `Boolean`
Default value: falseIgnore parser errors.
#### maxfiles
Type: `Number`
Default value: 1024Specify the maximum number of files to have open at any point.
#### maxfod
Type: `Number`
Default value: nullSpecify the per-project first-order density threshold.
#### maxcost
Type: `Number`
Default value: nullSpecify the per-project change cost threshold.
#### maxsize
Type: `Number`
Default value: nullSpecify the per-project core size threshold.
#### minmi
Type: `Number`
Default value: nullSpecify the per-module maintainability index threshold.
#### maxcyc
Type: `Number`
Default value: nullSpecify the per-function cyclomatic complexity threshold.
#### maxcycden
Type: `Number`
Default value: nullSpecify the per-function cyclomatic complexity density threshold.
#### maxhd
Type: `Number`
Default value: nullSpecify the per-function Halstead difficulty threshold.
#### maxhv
Type: `Number`
Default value: nullSpecify the per-function Halstead volume threshold.
#### maxhe
Type: `Number`
Default value: nullSpecify the per-function Halstead effort threshold.
#### onlyfailures
Type: `Boolean`
Default value: trueReport only modules and functions, which failed the complexity checks.
#### silent
Type: `Boolean`
Default value: falseDo not write any output to the console.
#### logicalor
Type: `Boolean`
Default value: falseCisregard operator || as source of cyclomatic complexity.
#### switchcase
Type: `Boolean`
Default value: falseDisregard switch statements as source of cyclomatic complexity.
#### forin
Type: `Boolean`
Default value: falseTreat for...in statements as source of cyclomatic complexity.
#### trycatch
Type: `Boolean`
Default value: falseTreat catch clauses as source of cyclomatic complexity.
#### newmi
Type: `Boolean`
Default value: trueUse the Microsoft-variant maintainability index (scale of 0 to 100).
#### nocoresize
Type: `Boolean`
Default value: falseDo not calculate core size or visibility matrix.
### Task Data
#### src
Type: `String|Array|Object`
Default value: []Source files to have their complexity checked. Grunt file list specification.
### Loading
Load the plugin in `Gruntfile.js`:
```javascript
grunt.loadNpmTasks('grunt-escomplex-report');
```## Build
Call the `escomplex-report` task:
```shell
$ grunt escomplex-report
```or integrate it to your build sequence in `Gruntfile.js`:
```js
grunt.registerTask('default', ['escomplex-report', ...]);
```## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding
style. Add unit tests for any new or changed functionality. Lint and test
your code using Grunt.## Release History
* 2018-05-03 [v1.0.1] Supported installation if NPM proxy cache is used
* 2018-04-27 [v1.0.0] Dropped support of Node.js 4
* 2018-01-29 [v0.0.1] Initial release## License
Copyright (c) 2018-2019 Ferdinand Prantl
Licensed under the MIT license.
[node]: https://nodejs.org
[npm]: https://npmjs.org
[package.json]: https://docs.npmjs.com/files/package.json
[Grunt]: https://gruntjs.com
[Gruntfile]: https://gruntjs.com/sample-gruntfile
[Getting Gtarted]: https://github.com/gruntjs/grunt/wiki/Getting-started
[v0.0.1]: https://github.com/prantlf/grunt-escomplex-report/releases/tag/v0.0.1
[v1.0.0]: https://github.com/prantlf/grunt-escomplex-report/releases/tag/v1.0.0
[v1.0.1]: https://github.com/prantlf/grunt-escomplex-report/releases/tag/v1.0.1