Gottwik/Enduro

View on GitHub
libs/context_tools/context_modifiers.js

Summary

Maintainability
A
25 mins
Test Coverage

Function add_sibling_to_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

context_modifiers.prototype.add_sibling_to_type = function (context, type_to_search_for, added_termination, value) {
    
    const self = this

    for (key in context) {
Severity: Minor
Found in libs/context_tools/context_modifiers.js - About 25 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

Trailing spaces not allowed.
Open

    

Disallow trailing spaces at the end of lines (no-trailing-spaces)

(fixable) The --fix option on the [command line](../user-guide/command-line-interface#fix) automatically fixes problems reported by this rule.

Sometimes in the course of editing files, you can end up with extra whitespace at the end of lines. These whitespace differences can be picked up by source control systems and flagged as diffs, causing frustration for developers. While this extra whitespace causes no functional issues, many code conventions require that trailing spaces be removed before checkin.

Rule Details

The following patterns are considered problems:

/*eslint no-trailing-spaces: "error"*/

// spaces, tabs and unicode whitespaces
// are not allowed at the end of lines
var foo = 0;//•••••
var baz = 5;//••

The following patterns are not considered problems:

/*eslint no-trailing-spaces: "error"*/

var foo = 0;

var baz = 5;

Options

There is one option for this rule, skipBlankLines. When set to true, the rule will not flag any lines that are made up purely of whitespace. In short, if a line is zero-length after being trimmed of whitespace, then the rule will not flag that line when skipBlankLines is enabled.

You can enable this option in your config like this:

{
    "no-trailing-spaces": ["error", { "skipBlankLines": true }]
}

With this option enabled, The following patterns are not considered problems:

/*eslint no-trailing-spaces: ["error", { "skipBlankLines": true }]*/

var foo = 0;
//••••
var baz = 5;

Source: http://eslint.org/docs/rules/

There are no issues that match your filters.

Category
Status