Turn off cyclmatic complexity in JSHint

user2950593 picture user2950593 · Nov 8, 2013 · Viewed 10.3k times · Source

I am using JSHint and I want to turn off cyclomatic complexity.

How can I do this?

Answer

user2950593 picture user2950593 · Nov 8, 2013

Let's say our function is named x. Then we should just write this :

function x () {
    /*jshint maxcomplexity:6 */
}

Where 6 is number js hint usually says it in console like this:

static/desktop.blocks/days/days.js: line 57, col 27, This function's cyclomatic complexity is too high. (6)