npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grunt-escomplex-report

v1.0.3

Published

Software complexity analysis for JavaScript projects.

Downloads

14

Readme

grunt-escomplex-report

NPM version Build Status Coverage Status Dependency Status devDependency Status Built with Grunt

NPM Downloads

Software complexity analysis for JavaScript projects.

Table of Contents

Installation

You need node >= 4, npm and grunt >= 0.4.5 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:

$ 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:

grunt.initConfig({
  'escomplex-report': {
    all: {
      src: ['../../src/**/!(*.spec)+(.js)'],
      options: {
        output: 'complexity.txt'
      }
    }
  }
});

Default options support the most usual usage scenario:

'escomplex-report': {
  options: {
    format: 'plain',
    output: null,
    onlyfailures: true,
    silent: false,
    newmi: true,
    force: false
  },
  ...
}

Task Options

force

Type: Boolean Default value: false

If 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: null

Specify the output format of the report.

output

Type: String Default value: null

Specify an output file for the report.

ignoreerrors

Type: Boolean Default value: false

Ignore parser errors.

maxfiles

Type: Number Default value: 1024

Specify the maximum number of files to have open at any point.

maxfod

Type: Number Default value: null

Specify the per-project first-order density threshold.

maxcost

Type: Number Default value: null

Specify the per-project change cost threshold.

maxsize

Type: Number Default value: null

Specify the per-project core size threshold.

minmi

Type: Number Default value: null

Specify the per-module maintainability index threshold.

maxcyc

Type: Number Default value: null

Specify the per-function cyclomatic complexity threshold.

maxcycden

Type: Number Default value: null

Specify the per-function cyclomatic complexity density threshold.

maxhd

Type: Number Default value: null

Specify the per-function Halstead difficulty threshold.

maxhv

Type: Number Default value: null

Specify the per-function Halstead volume threshold.

maxhe

Type: Number Default value: null

Specify the per-function Halstead effort threshold.

onlyfailures

Type: Boolean Default value: true

Report only modules and functions, which failed the complexity checks.

silent

Type: Boolean Default value: false

Do not write any output to the console.

logicalor

Type: Boolean Default value: false

Cisregard operator || as source of cyclomatic complexity.

switchcase

Type: Boolean Default value: false

Disregard switch statements as source of cyclomatic complexity.

forin

Type: Boolean Default value: false

Treat for...in statements as source of cyclomatic complexity.

trycatch

Type: Boolean Default value: false

Treat catch clauses as source of cyclomatic complexity.

newmi

Type: Boolean Default value: true

Use the Microsoft-variant maintainability index (scale of 0 to 100).

nocoresize

Type: Boolean Default value: false

Do 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:

grunt.loadNpmTasks('grunt-escomplex-report');

Build

Call the escomplex-report task:

$ grunt escomplex-report

or integrate it to your build sequence in Gruntfile.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.