handsontable/formula.js

View on GitHub

Showing 506 of 506 total issues

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

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

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

    exports.CUMIPMT = function(rate, periods, value, start, end, type) {
    Severity: Minor
    Found in lib/financial.js - About 45 mins to fix

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

      exports.IPMT = function(rate, period, periods, present, future, type) {
      Severity: Minor
      Found in lib/financial.js - About 45 mins to fix

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

        exports.CUMPRINC = function(rate, periods, value, start, end, type) {
        Severity: Minor
        Found in lib/financial.js - About 45 mins to fix

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

          exports.PPMT = function(rate, period, periods, present, future, type) {
          Severity: Minor
          Found in lib/financial.js - About 45 mins to fix

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

            exports.UNIQUE = function () {
              var result = [];
              for (var i = 0; i < arguments.length; ++i) {
                var hasElement = false;
                var element    = arguments[i];
            Severity: Minor
            Found in lib/miscellaneous.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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              for (i = 0; i < data_y.length; i++) {
                s_y += Math.pow(data_y[i] - mean_y, 2);
              }
            Severity: Minor
            Found in lib/statistical.js and 1 other location - About 40 mins to fix
            lib/statistical.js on lines 1691..1693

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 49.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              for (i = 0; i < data_x.length; i++) {
                s_x += Math.pow(data_x[i] - mean_x, 2);
              }
            Severity: Minor
            Found in lib/statistical.js and 1 other location - About 40 mins to fix
            lib/statistical.js on lines 1694..1696

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 49.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Consider simplifying this complex logical expression.
            Open

                if ((!rangeLookup && row[0] === needle) ||
                  ((row[0] === needle) ||
                    (rangeLookup && typeof row[0] === "string" && row[0].toLowerCase().indexOf(needle.toLowerCase()) !== -1))) {
                  return (index < (row.length + 1) ? row[index - 1] : error.ref);
                }
            Severity: Major
            Found in lib/lookup-reference.js - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                  if ((!rangeLookup && row[0] === needle) ||
                    ((row[0] === needle) ||
                      (rangeLookup && typeof row[0] === "string" && row[0].toLowerCase().indexOf(needle.toLowerCase()) !== -1))) {
                    return (index < (row.length + 1) ? row[index - 1] : error.ref);
                  }
              Severity: Major
              Found in lib/lookup-reference.js - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                  if (p < 0 || p > 1 || d1 < 1 || d1 > Math.pow(10, 10) || d2 < 1 || d2 > Math.pow(10, 10)) {
                    return error.num;
                  }
                Severity: Major
                Found in lib/statistical.js - About 40 mins to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  exports.ISEVEN = function(number) {
                    return (Math.floor(Math.abs(number)) & 1) ? false : true;
                  };
                  Severity: Minor
                  Found in lib/information.js and 1 other location - About 40 mins to fix
                  lib/information.js on lines 70..72

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 48.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  exports.ISODD = function(number) {
                    return (Math.floor(Math.abs(number)) & 1) ? true : false;
                  };
                  Severity: Minor
                  Found in lib/information.js and 1 other location - About 40 mins to fix
                  lib/information.js on lines 45..47

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 48.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Function INV has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  exports.BETA.INV = function(probability, alpha, beta, A, B) {
                  Severity: Minor
                  Found in lib/statistical.js - About 35 mins to fix

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

                    exports.HYPGEOM.DIST = function(x, n, M, N, cumulative) {
                    Severity: Minor
                    Found in lib/statistical.js - About 35 mins to fix

                      Function NPER has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      exports.NPER = function(rate, payment, present, future, type) {
                      Severity: Minor
                      Found in lib/financial.js - About 35 mins to fix

                        Function DDB has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        exports.DDB = function(cost, salvage, life, period, factor) {
                        Severity: Minor
                        Found in lib/financial.js - About 35 mins to fix

                          Function FV has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          exports.FV = function(rate, periods, payment, value, type) {
                          Severity: Minor
                          Found in lib/financial.js - About 35 mins to fix

                            Function PMT has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

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