handsontable/formula.js

View on GitHub

Showing 207 of 506 total issues

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

exports.parseBool = function(bool) {
  if (typeof bool === 'boolean') {
    return bool;
  }

Severity: Minor
Found in lib/utils/common.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

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

exports.SUBSTITUTE = function(text, old_text, new_text, occurrence) {
  if (arguments.length < 2) {
    return error.na;
  }
  if (!text || !old_text || !new_text) {
Severity: Minor
Found in lib/text.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

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

exports.IPMT = function(rate, period, periods, present, future, type) {
  // Credits: algorithm inspired by Apache OpenOffice

  future = future || 0;
  type = type || 0;
Severity: Minor
Found in lib/financial.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

Function ACCRINT has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

exports.ACCRINT = function(issue, first, settlement, rate, par, frequency, basis) {
Severity: Major
Found in lib/financial.js - About 50 mins to fix

    Avoid deeply nested control flow statements.
    Open

            if (lookupArray[idx] === lookupValue) {
              return idx + 1;
            }
    Severity: Major
    Found in lib/lookup-reference.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

            if (lookupArray[idx] === lookupValue) {
              return idx + 1;
            } else if (lookupArray[idx] > lookupValue) {
              if (!indexValue) {
                index = idx + 1;
      Severity: Major
      Found in lib/lookup-reference.js - About 45 mins to fix

        Function DIST has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        exports.BETA.DIST = function(x, alpha, beta, cumulative, A, B) {
        Severity: Minor
        Found in lib/statistical.js - About 45 mins to fix

          Function AVERAGEA has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.AVERAGEA = function() {
            var range = utils.flatten(arguments);
            var n = range.length;
            var sum = 0;
            var count = 0;
          Severity: Minor
          Found in lib/statistical.js - About 45 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 MULT has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.MODE.MULT = function() {
            // Credits: Roönaän
            var range = utils.parseNumberArray(utils.flatten(arguments));
            if (range instanceof Error) {
              return range;
          Severity: Minor
          Found in lib/statistical.js - About 45 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 INC has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.PERCENTRANK.INC = function(array, x, significance) {
            significance = (significance === undefined) ? 3 : significance;
            array = utils.parseNumberArray(utils.flatten(array));
            x = utils.parseNumber(x);
            significance = utils.parseNumber(significance);
          Severity: Minor
          Found in lib/statistical.js - About 45 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

          Avoid deeply nested control flow statements.
          Open

                    if (_ij instanceof Error) {
                      return _ij;
                    }
          Severity: Major
          Found in lib/math-trig.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                      if (!currentCriteriaResult) {
                        var isWildcard = criteria[p] === void 0 || criteria[p] === '*';
            
                        if (isWildcard) {
                          currentCriteriaResult = true;
            Severity: Major
            Found in lib/database.js - About 45 mins to fix

              Function MATH has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              exports.FLOOR.MATH = function(number, significance, mode) {
                significance = (significance === undefined) ? 1 : significance;
                mode = (mode === undefined) ? 0 : mode;
              
                number = utils.parseNumber(number);
              Severity: Minor
              Found in lib/math-trig.js - About 45 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 EXC has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              exports.PERCENTRANK.EXC = function(array, x, significance) {
                significance = (significance === undefined) ? 3 : significance;
                array = utils.parseNumberArray(utils.flatten(array));
                x = utils.parseNumber(x);
                significance = utils.parseNumber(significance);
              Severity: Minor
              Found in lib/statistical.js - About 45 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 analyzeTokens has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function analyzeTokens(tokens) {
                var literalValue = '';
                var analyzedTokens = [];
              
                for (var i = 0; i < tokens.length; i++) {
              Severity: Minor
              Found in lib/utils/criteria-eval.js - About 45 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

              Avoid deeply nested control flow statements.
              Open

                      if (lookupArray[idx].toLowerCase().match(lookupValue.toLowerCase())) {
                        return idx + 1;
                      }
              Severity: Major
              Found in lib/lookup-reference.js - About 45 mins to fix

                Function VARPA has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                exports.VARPA = function() {
                  var range = utils.flatten(arguments);
                  var n = range.length;
                  var sigma = 0;
                  var count = 0;
                Severity: Minor
                Found in lib/statistical.js - About 45 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

                Avoid deeply nested control flow statements.
                Open

                      } else if (i === b) {
                        if (data[j] > bins[b - 1]) {
                          r[b] += 1;
                        }
                      }
                Severity: Major
                Found in lib/statistical.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                          if (data[j] > bins[i - 1] && data[j] <= bins[i]) {
                            r[i] += 1;
                          }
                  Severity: Major
                  Found in lib/statistical.js - About 45 mins to fix

                    Function RATE has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    exports.RATE = function(periods, payment, present, future, type, guess) {
                    Severity: Minor
                    Found in lib/financial.js - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language