handsontable/formula.js

View on GitHub

Showing 207 of 506 total issues

Function SWITCH has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

exports.SWITCH = function () {
  var result;

  if (arguments.length > 0)  {
    var targetValue = arguments[0];
Severity: Minor
Found in lib/logical.js - About 2 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 YEARFRAC has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.YEARFRAC = function(start_date, end_date, basis) {
  start_date = utils.parseDate(start_date);
  if (start_date instanceof Error) {
    return start_date;
  }
Severity: Major
Found in lib/date-time.js - About 2 hrs to fix

    Function TEST has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.CHISQ.TEST = function(observed, expected) {
      if (arguments.length !== 2) {
        return error.na;
      }
    
    
    Severity: Major
    Found in lib/statistical.js - About 2 hrs to fix

      Function GROWTH has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.GROWTH = function(known_y, known_x, new_x, use_const) {
        // Credits: Ilmari Karonen (http://stackoverflow.com/questions/14161990/how-to-implement-growth-function-in-javascript)
      
        known_y = utils.parseNumberArray(known_y);
        if (known_y instanceof Error) {
      Severity: Major
      Found in lib/statistical.js - About 2 hrs to fix

        Function MATCH has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.MATCH = function(lookupValue, lookupArray, matchType) {
          if (!lookupValue && !lookupArray) {
            return error.na;
          }
        
        
        Severity: Major
        Found in lib/lookup-reference.js - About 2 hrs to fix

          Function IRR has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.IRR = function(values, guess) {
            // Credits: algorithm inspired by Apache OpenOffice
          
            guess = guess || 0;
          
          
          Severity: Minor
          Found in lib/financial.js - About 2 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 INTL has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.NETWORKDAYS.INTL = function(start_date, end_date, weekend, holidays) {
            start_date = utils.parseDate(start_date);
          
            if (start_date instanceof Error) {
              return start_date;
          Severity: Major
          Found in lib/date-time.js - About 2 hrs to fix

            Function IRR has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.IRR = function(values, guess) {
              // Credits: algorithm inspired by Apache OpenOffice
            
              guess = guess || 0;
            
            
            Severity: Major
            Found in lib/financial.js - About 2 hrs to fix

              Function SUBTOTAL has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports.SUBTOTAL = function(function_code, ref1) {
                function_code = utils.parseNumber(function_code);
                if (function_code instanceof Error) {
                  return function_code;
                }
              Severity: Minor
              Found in lib/math-trig.js - About 2 hrs to fix

                Function INTL has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                exports.WORKDAY.INTL = function(start_date, days, weekend, holidays) {
                  start_date = utils.parseDate(start_date);
                  if (start_date instanceof Error) {
                    return start_date;
                  }
                Severity: Minor
                Found in lib/date-time.js - About 2 hrs to fix

                  Function findResultIndex has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function findResultIndex(database, criterias) {
                    var matches = {};
                    for (var i = 1; i < database[0].length; ++i) {
                      matches[i] = true;
                    }
                  Severity: Minor
                  Found in lib/database.js - About 1 hr to fix

                    Function HEX2BIN has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                    exports.HEX2BIN = function(number, places) {
                      // Return error if number is not hexadecimal or contains more than ten characters (10 digits)
                      if (!/^[0-9A-Fa-f]{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 OCT2BIN has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                    exports.OCT2BIN = function(number, places) {
                      // Return error if number is not hexadecimal 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 AGGREGATE has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    exports.AGGREGATE = function(function_num, options, ref1, ref2) {
                      function_num = utils.parseNumber(function_num);
                      options = utils.parseNumber(function_num);
                      if (utils.anyIsError(function_num, options)) {
                        return error.value;
                    Severity: Minor
                    Found in lib/math-trig.js - About 1 hr to fix

                      Function AVERAGEIFS has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                      exports.AVERAGEIFS = function() {
                        // Does not work with multi dimensional ranges yet!
                        //http://office.microsoft.com/en-001/excel-help/averageifs-function-HA010047493.aspx
                        var args = utils.argsToArray(arguments);
                        var criteriaLength = (args.length - 1) / 2;
                      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 COMPLEX has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                      exports.COMPLEX = function(real, imaginary, suffix) {
                        real = utils.parseNumber(real);
                        imaginary = utils.parseNumber(imaginary);
                        if (utils.anyIsError(real, imaginary)) {
                          return real;
                      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 CUMPRINC has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                      exports.CUMPRINC = function(rate, periods, value, start, end, type) {
                        // Credits: algorithm inspired by Apache OpenOffice
                        // Credits: Hannes Stiebitzhofer for the translations of function and variable names
                      
                        rate = utils.parseNumber(rate);
                      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 RATE has 43 lines of code (exceeds 25 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

                        Function IMAGINARY has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        exports.IMAGINARY = function(inumber) {
                          if (inumber === undefined || inumber === true || inumber === false) {
                            return error.value;
                          }
                        
                        
                        Severity: Minor
                        Found in lib/engineering.js - About 1 hr to fix

                          Function GROWTH has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                          exports.GROWTH = function(known_y, known_x, new_x, use_const) {
                            // Credits: Ilmari Karonen (http://stackoverflow.com/questions/14161990/how-to-implement-growth-function-in-javascript)
                          
                            known_y = utils.parseNumberArray(known_y);
                            if (known_y instanceof Error) {
                          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

                          Severity
                          Category
                          Status
                          Source
                          Language