collinbrewer/expression

View on GitHub

Showing 7 of 7 total issues

Function parse has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

Expression.parse = function (s, a) {
    var e;
    var isArray = (a && a.constructor === Array);
    var args = (a && isArray ? a : []);
    var vars = (a && isArray ? {} : a);
Severity: Minor
Found in src/expression.js - About 5 hrs 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 parse has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Expression.parse = function (s, a) {
    var e;
    var isArray = (a && a.constructor === Array);
    var args = (a && isArray ? a : []);
    var vars = (a && isArray ? {} : a);
Severity: Major
Found in src/expression.js - About 2 hrs to fix

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

    function parseArgs (argsString) {
        var args = [];
        var i = 0;
        var l = argsString.length;
    
    
    Severity: Minor
    Found in src/expression-types/function-expression.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 parse has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    FunctionExpression.parse = function (s) {
        s = s.trim();
    
        var e = null;
        var fun = s.substr(0, 8);
    Severity: Minor
    Found in src/expression-types/function-expression.js - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                          if (s.match(/[\+\-\/\*]/) || s.match(/\s?.*?\s?\(.*?\)/)) {
                              e = FunctionExpression.parse(s);
                          }
                          else {
                              // e=s; // keypath?
      Severity: Major
      Found in src/expression.js - About 45 mins to fix

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

        FunctionExpression.parse = function (s) {
            s = s.trim();
        
            var e = null;
            var fun = s.substr(0, 8);
        Severity: Minor
        Found in src/expression-types/function-expression.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

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

        function variance (a) {
            var average = avg(a);
            var i = a.length;
            var v = 0;
            var n;
        Severity: Minor
        Found in src/util/functions.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

        Severity
        Category
        Status
        Source
        Language