maestro-server/analytics-front

View on GitHub
docs/graph/vendor/polyfill.js

Summary

Maintainability
A
2 hrs
Test Coverage

Function forEach has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  Array.prototype.forEach = function (callback, thisArg) {
    var T, k;

    if (this == null) {
      throw new TypeError(' this is null or not defined');
Severity: Minor
Found in docs/graph/vendor/polyfill.js - About 1 hr 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

Function keys has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Object.keys = (function () {
    'use strict';
    var hasOwnProperty = Object.prototype.hasOwnProperty,
        hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),
        dontEnums = [
Severity: Minor
Found in docs/graph/vendor/polyfill.js - About 1 hr to fix

    Unexpected var, use let or const instead.
    Open

          var result = [], prop, i;
    Severity: Minor
    Found in docs/graph/vendor/polyfill.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    Unexpected var, use let or const instead.
    Open

        var T, k;
    Severity: Minor
    Found in docs/graph/vendor/polyfill.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    Unexpected var, use let or const instead.
    Open

        var O = Object(this);
    Severity: Minor
    Found in docs/graph/vendor/polyfill.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    Use the global form of 'use strict'.
    Open

    if (!Object.keys) {
    Severity: Minor
    Found in docs/graph/vendor/polyfill.js by eslint

    require or disallow strict mode directives (strict)

    A strict mode directive is a "use strict" literal at the beginning of a script or function body. It enables strict mode semantics.

    When a directive occurs in global scope, strict mode applies to the entire script:

    "use strict";
    
    // strict mode
    
    function foo() {
        // strict mode
    }

    When a directive occurs at the beginning of a function body, strict mode applies only to that function, including all contained functions:

    function foo() {
        "use strict";
        // strict mode
    }
    
    function foo2() {
        // not strict mode
    };
    
    (function() {
        "use strict";
        function bar() {
            // strict mode
        }
    }());

    In the CommonJS module system, a hidden function wraps each module and limits the scope of a "global" strict mode directive.

    In ECMAScript modules, which always have strict mode semantics, the directives are unnecessary.

    Rule Details

    This rule requires or disallows strict mode directives.

    This rule disallows strict mode directives, no matter which option is specified, if ESLint configuration specifies either of the following as [parser options](../user-guide/configuring#specifying-parser-options):

    • "sourceType": "module" that is, files are ECMAScript modules
    • "impliedStrict": true property in the ecmaFeatures object

    This rule disallows strict mode directives, no matter which option is specified, in functions with non-simple parameter lists (for example, parameter lists with default parameter values) because that is a syntax error in ECMAScript 2016 and later. See the examples of the function option.

    Options

    This rule has a string option:

    • "safe" (default) corresponds either of the following options:
      • "global" if ESLint considers a file to be a CommonJS module
      • "function" otherwise
    • "global" requires one strict mode directive in the global scope (and disallows any other strict mode directives)
    • "function" requires one strict mode directive in each top-level function declaration or expression (and disallows any other strict mode directives)
    • "never" disallows strict mode directives

    safe

    The "safe" option corresponds to the "global" option if ESLint considers a file to be a Node.js or CommonJS module because the configuration specifies either of the following:

    • node or commonjs [environments](../user-guide/configuring#specifying-environments)
    • "globalReturn": true property in the ecmaFeatures object of [parser options](../user-guide/configuring#specifying-parser-options)

    Otherwise the "safe" option corresponds to the "function" option.

    global

    Examples of incorrect code for this rule with the "global" option:

    /*eslint strict: ["error", "global"]*/
    
    function foo() {
    }
    /*eslint strict: ["error", "global"]*/
    
    function foo() {
        "use strict";
    }
    /*eslint strict: ["error", "global"]*/
    
    "use strict";
    
    function foo() {
        "use strict";
    }

    Examples of correct code for this rule with the "global" option:

    /*eslint strict: ["error", "global"]*/
    
    "use strict";
    
    function foo() {
    }

    function

    This option ensures that all function bodies are strict mode code, while global code is not. Particularly if a build step concatenates multiple scripts, a strict mode directive in global code of one script could unintentionally enable strict mode in another script that was not intended to be strict code.

    Examples of incorrect code for this rule with the "function" option:

    /*eslint strict: ["error", "function"]*/
    
    "use strict";
    
    function foo() {
    }
    /*eslint strict: ["error", "function"]*/
    
    function foo() {
    }
    
    (function() {
        function bar() {
            "use strict";
        }
    }());
    /*eslint strict: ["error", "function"]*/
    /*eslint-env es6*/
    
    // Illegal "use strict" directive in function with non-simple parameter list.
    // This is a syntax error since ES2016.
    function foo(a = 1) {
        "use strict";
    }
    
    // We cannot write "use strict" directive in this function.
    // So we have to wrap this function with a function with "use strict" directive.
    function foo(a = 1) {
    }

    Examples of correct code for this rule with the "function" option:

    /*eslint strict: ["error", "function"]*/
    
    function foo() {
        "use strict";
    }
    
    (function() {
        "use strict";
    
        function bar() {
        }
    
        function baz(a = 1) {
        }
    }());
    
    var foo = (function() {
        "use strict";
    
        return function foo(a = 1) {
        };
    }());

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint strict: ["error", "never"]*/
    
    "use strict";
    
    function foo() {
    }
    /*eslint strict: ["error", "never"]*/
    
    function foo() {
        "use strict";
    }

    Examples of correct code for this rule with the "never" option:

    /*eslint strict: ["error", "never"]*/
    
    function foo() {
    }

    earlier default (removed)

    (removed) The default option (that is, no string option specified) for this rule was removed in ESLint v1.0. The "function" option is most similar to the removed option.

    This option ensures that all functions are executed in strict mode. A strict mode directive must be present in global code or in every top-level function declaration or expression. It does not concern itself with unnecessary strict mode directives in nested functions that are already strict, nor with multiple strict mode directives at the same level.

    Examples of incorrect code for this rule with the earlier default option which has been removed:

    // "strict": "error"
    
    function foo() {
    }
    // "strict": "error"
    
    (function() {
        function bar() {
            "use strict";
        }
    }());

    Examples of correct code for this rule with the earlier default option which has been removed:

    // "strict": "error"
    
    "use strict";
    
    function foo() {
    }
    // "strict": "error"
    
    function foo() {
        "use strict";
    }
    // "strict": "error"
    
    (function() {
        "use strict";
        function bar() {
            "use strict";
        }
    }());

    When Not To Use It

    In a codebase that has both strict and non-strict code, either turn this rule off, or selectively disable it where necessary. For example, functions referencing arguments.callee are invalid in strict mode. A full list of strict mode differences is available on MDN. Source: http://eslint.org/docs/rules/

    Unexpected var, use let or const instead.
    Open

        var len = O.length >>> 0;
    Severity: Minor
    Found in docs/graph/vendor/polyfill.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    Use the global form of 'use strict'.
    Open

        'use strict';
    Severity: Minor
    Found in docs/graph/vendor/polyfill.js by eslint

    require or disallow strict mode directives (strict)

    A strict mode directive is a "use strict" literal at the beginning of a script or function body. It enables strict mode semantics.

    When a directive occurs in global scope, strict mode applies to the entire script:

    "use strict";
    
    // strict mode
    
    function foo() {
        // strict mode
    }

    When a directive occurs at the beginning of a function body, strict mode applies only to that function, including all contained functions:

    function foo() {
        "use strict";
        // strict mode
    }
    
    function foo2() {
        // not strict mode
    };
    
    (function() {
        "use strict";
        function bar() {
            // strict mode
        }
    }());

    In the CommonJS module system, a hidden function wraps each module and limits the scope of a "global" strict mode directive.

    In ECMAScript modules, which always have strict mode semantics, the directives are unnecessary.

    Rule Details

    This rule requires or disallows strict mode directives.

    This rule disallows strict mode directives, no matter which option is specified, if ESLint configuration specifies either of the following as [parser options](../user-guide/configuring#specifying-parser-options):

    • "sourceType": "module" that is, files are ECMAScript modules
    • "impliedStrict": true property in the ecmaFeatures object

    This rule disallows strict mode directives, no matter which option is specified, in functions with non-simple parameter lists (for example, parameter lists with default parameter values) because that is a syntax error in ECMAScript 2016 and later. See the examples of the function option.

    Options

    This rule has a string option:

    • "safe" (default) corresponds either of the following options:
      • "global" if ESLint considers a file to be a CommonJS module
      • "function" otherwise
    • "global" requires one strict mode directive in the global scope (and disallows any other strict mode directives)
    • "function" requires one strict mode directive in each top-level function declaration or expression (and disallows any other strict mode directives)
    • "never" disallows strict mode directives

    safe

    The "safe" option corresponds to the "global" option if ESLint considers a file to be a Node.js or CommonJS module because the configuration specifies either of the following:

    • node or commonjs [environments](../user-guide/configuring#specifying-environments)
    • "globalReturn": true property in the ecmaFeatures object of [parser options](../user-guide/configuring#specifying-parser-options)

    Otherwise the "safe" option corresponds to the "function" option.

    global

    Examples of incorrect code for this rule with the "global" option:

    /*eslint strict: ["error", "global"]*/
    
    function foo() {
    }
    /*eslint strict: ["error", "global"]*/
    
    function foo() {
        "use strict";
    }
    /*eslint strict: ["error", "global"]*/
    
    "use strict";
    
    function foo() {
        "use strict";
    }

    Examples of correct code for this rule with the "global" option:

    /*eslint strict: ["error", "global"]*/
    
    "use strict";
    
    function foo() {
    }

    function

    This option ensures that all function bodies are strict mode code, while global code is not. Particularly if a build step concatenates multiple scripts, a strict mode directive in global code of one script could unintentionally enable strict mode in another script that was not intended to be strict code.

    Examples of incorrect code for this rule with the "function" option:

    /*eslint strict: ["error", "function"]*/
    
    "use strict";
    
    function foo() {
    }
    /*eslint strict: ["error", "function"]*/
    
    function foo() {
    }
    
    (function() {
        function bar() {
            "use strict";
        }
    }());
    /*eslint strict: ["error", "function"]*/
    /*eslint-env es6*/
    
    // Illegal "use strict" directive in function with non-simple parameter list.
    // This is a syntax error since ES2016.
    function foo(a = 1) {
        "use strict";
    }
    
    // We cannot write "use strict" directive in this function.
    // So we have to wrap this function with a function with "use strict" directive.
    function foo(a = 1) {
    }

    Examples of correct code for this rule with the "function" option:

    /*eslint strict: ["error", "function"]*/
    
    function foo() {
        "use strict";
    }
    
    (function() {
        "use strict";
    
        function bar() {
        }
    
        function baz(a = 1) {
        }
    }());
    
    var foo = (function() {
        "use strict";
    
        return function foo(a = 1) {
        };
    }());

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint strict: ["error", "never"]*/
    
    "use strict";
    
    function foo() {
    }
    /*eslint strict: ["error", "never"]*/
    
    function foo() {
        "use strict";
    }

    Examples of correct code for this rule with the "never" option:

    /*eslint strict: ["error", "never"]*/
    
    function foo() {
    }

    earlier default (removed)

    (removed) The default option (that is, no string option specified) for this rule was removed in ESLint v1.0. The "function" option is most similar to the removed option.

    This option ensures that all functions are executed in strict mode. A strict mode directive must be present in global code or in every top-level function declaration or expression. It does not concern itself with unnecessary strict mode directives in nested functions that are already strict, nor with multiple strict mode directives at the same level.

    Examples of incorrect code for this rule with the earlier default option which has been removed:

    // "strict": "error"
    
    function foo() {
    }
    // "strict": "error"
    
    (function() {
        function bar() {
            "use strict";
        }
    }());

    Examples of correct code for this rule with the earlier default option which has been removed:

    // "strict": "error"
    
    "use strict";
    
    function foo() {
    }
    // "strict": "error"
    
    function foo() {
        "use strict";
    }
    // "strict": "error"
    
    (function() {
        "use strict";
        function bar() {
            "use strict";
        }
    }());

    When Not To Use It

    In a codebase that has both strict and non-strict code, either turn this rule off, or selectively disable it where necessary. For example, functions referencing arguments.callee are invalid in strict mode. A full list of strict mode differences is available on MDN. Source: http://eslint.org/docs/rules/

    Unexpected var, use let or const instead.
    Open

          var kValue;
    Severity: Minor
    Found in docs/graph/vendor/polyfill.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    Unexpected var, use let or const instead.
    Open

        var hasOwnProperty = Object.prototype.hasOwnProperty,
    Severity: Minor
    Found in docs/graph/vendor/polyfill.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    There are no issues that match your filters.

    Category
    Status