Gottwik/Enduro

View on GitHub
libs/trollhunter.js

Summary

Maintainability
A
55 mins
Test Coverage

Function verify_passphrase has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

trollhunter.prototype.verify_passphrase = function (passphrase) {
    return new Promise(function (resolve, reject) {

        if (!passphrase) {
            return reject('no passphrase provided')
Severity: Minor
Found in libs/trollhunter.js - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

More than 1 blank line not allowed.
Open


Severity: Minor
Found in libs/trollhunter.js by eslint

Disallows multiple blank lines (no-multiple-empty-lines)

Some developers prefer to have multiple blank lines removed, while others feel that it helps improve readability. Whitespace is useful for separating logical sections of code, but excess whitespace takes up more of the screen.

Rule Details

This rule aims to reduce the scrolling required when reading through your code. It will warn when the maximum amount of empty lines has been exceeded.

Options

The second argument can be used to configure this rule:

  • max sets the maximum number of consecutive blank lines.
  • maxEOF can be used to set a different number for the end of file. The last blank lines will then be treated differently. If omitted, the max option is applied at the end of the file.
  • maxBOF can be used to set a different number for the beginning of the file. If omitted, the 'max' option is applied at the beginning of the file.

max

In the following example, the error is the severity of the rule, and the max property is the maximum number of empty lines (2 in this example).

"no-multiple-empty-lines": ["error", {"max": 2}]

The following patterns are considered problems:

/*eslint no-multiple-empty-lines: ["error", {max: 2}]*/


var foo = 5;



var bar = 3;

The following patterns are not considered problems:

/*eslint no-multiple-empty-lines: ["error", {max: 2}]*/


var foo = 5;


var bar = 3;

maxEOF

"no-multiple-empty-lines": ["error", {"max": 2, "maxEOF": 1}]

The following patterns are considered problems:

/*eslint no-multiple-empty-lines: ["error", {max: 2, maxEOF: 1}]*/


var foo = 5;


var bar = 3;

The following patterns are not considered problems:

/*eslint no-multiple-empty-lines: ["error", {max: 2, maxEOF: 1}]*/


var foo = 5;


var bar = 3;

maxBOF

"no-multiple-empty-lines": ["error", {"max": 2, "maxBOF": 0}]

The following patterns are considered problems:

/*eslint no-multiple-empty-lines: ["error", {max: 2, maxBOF: 0}]*/


var foo = 5;


var bar = 3;

The following patterns are not considered problems:

/*eslint no-multiple-empty-lines: ["error", {max: 2, maxBOF: 0}]*/
var foo = 5;


var bar = 3;

When Not To Use It

If you do not care about extra blank lines, turn this off. Source: http://eslint.org/docs/rules/

There are no issues that match your filters.

Category
Status