handsontable/formula.js

View on GitHub

Showing 207 of 506 total issues

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

exports.DEC2OCT = function(number, places) {
  number = utils.parseNumber(number);
  if (number instanceof Error) {
    return number;
  }
Severity: Minor
Found in lib/engineering.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 VLOOKUP has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

exports.VLOOKUP = function (needle, table, index, rangeLookup) {
  if (!needle || !table || !index) {
    return error.na;
  }

Severity: Minor
Found in lib/lookup-reference.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 BIN2HEX has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

exports.BIN2HEX = function(number, places) {
  // Return error if number is not binary or contains more than 10 characters (10 digits)
  if (!isValidBinaryNumber(number)) {
    return error.num;
  }
Severity: Minor
Found in lib/engineering.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 HLOOKUP has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

exports.HLOOKUP = function (needle, table, index, rangeLookup) {
  if (!needle || !table || !index) {
    return error.na;
  }

Severity: Minor
Found in lib/lookup-reference.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 RATE has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

exports.RATE = function(periods, payment, present, future, type, guess) {
  // Credits: rabugento

  guess = (guess === undefined) ? 0.01 : guess;
  future = (future === undefined) ? 0 : future;
Severity: Minor
Found in lib/financial.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 EXC has 28 lines of code (exceeds 25 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 1 hr to fix

    Function INC has 28 lines of code (exceeds 25 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 1 hr to fix

      Function PROB has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.PROB = function(range, probability, lower, upper) {
        if (lower === undefined) {
          return 0;
        }
        upper = (upper === undefined) ? lower : upper;
      Severity: Minor
      Found in lib/statistical.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 BIN2OCT has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.BIN2OCT = function(number, places) {
        // Return error if number is not binary or contains more than 10 characters (10 digits)
        if (!isValidBinaryNumber(number)) {
          return error.num;
        }
      Severity: Minor
      Found in lib/engineering.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 IMARGUMENT has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.IMARGUMENT = function(inumber) {
        // Lookup real and imaginary coefficients using exports.js [http://formulajs.org]
        var x = exports.IMREAL(inumber);
        var y = exports.IMAGINARY(inumber);
      
      
      Severity: Minor
      Found in lib/engineering.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 OCT2HEX has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.OCT2HEX = function(number, places) {
        // Return error if number is not octal or contains more than ten characters (10 digits)
        if (!/^[0-7]{1,10}$/.test(number)) {
          return error.num;
        }
      Severity: Minor
      Found in lib/engineering.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 parseDate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.parseDate = function(date) {
        if (!isNaN(date)) {
          if (date instanceof Date) {
            return new Date(date);
          }
      Severity: Minor
      Found in lib/utils/common.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 AVERAGEIF has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.AVERAGEIF = function(range, criteria, average_range) {
        if (arguments.length <= 1) {
          return error.na;
        }
        average_range = average_range || range;
      Severity: Minor
      Found in lib/statistical.js - About 1 hr to fix

        Function IMARGUMENT has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.IMARGUMENT = function(inumber) {
          // Lookup real and imaginary coefficients using exports.js [http://formulajs.org]
          var x = exports.IMREAL(inumber);
          var y = exports.IMAGINARY(inumber);
        
        
        Severity: Minor
        Found in lib/engineering.js - About 1 hr to fix

          Function FREQUENCY has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.FREQUENCY = function(data, bins) {
            data = utils.parseNumberArray(utils.flatten(data));
            bins = utils.parseNumberArray(utils.flatten(bins));
            if (utils.anyIsError(data, bins)) {
              return error.value;
          Severity: Minor
          Found in lib/statistical.js - About 1 hr to fix

            Function IPMT has 27 lines of code (exceeds 25 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 1 hr to fix

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

              exports.flattenShallow = function(array) {
                if (!array || !array.reduce) {
                  return array;
                }
              
              
              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 SUMIF has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              exports.SUMIF = function(range, criteria) {
                range = utils.parseNumberArray(utils.flatten(range));
              
                if (range instanceof Error) {
                  return range;
              Severity: Minor
              Found in lib/math-trig.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 CEILING has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              exports.CEILING = function(number, significance, mode) {
                significance = (significance === undefined) ? 1 : Math.abs(significance);
                mode = mode || 0;
              
                number = utils.parseNumber(number);
              Severity: Minor
              Found in lib/math-trig.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 INTERVAL has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              exports.INTERVAL = function (second) {
                if (typeof second !== 'number' && typeof second !== 'string') {
                  return error.value;
                } else {
                  second = parseInt(second, 10);
              Severity: Minor
              Found in lib/date-time.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

              Severity
              Category
              Status
              Source
              Language