handsontable/formula.js

View on GitHub

Showing 506 of 506 total issues

File statistical.js has 1548 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var mathTrig = require('./math-trig');
var text = require('./text');
var jStat = require('jstat');
var utils = require('./utils/common');
var evalExpression = require('./utils/criteria-eval');
Severity: Major
Found in lib/statistical.js - About 4 days to fix

    File engineering.js has 1054 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    var error = require('./utils/error');
    var jStat = require('jstat');
    var text = require('./text');
    var utils = require('./utils/common');
    var bessel = require('bessel');
    Severity: Major
    Found in lib/engineering.js - About 2 days to fix

      File math-trig.js has 1010 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      var utils = require('./utils/common');
      var error = require('./utils/error');
      var statistical = require('./statistical');
      var information = require('./information');
      var evalExpression = require('./utils/criteria-eval');
      Severity: Major
      Found in lib/math-trig.js - About 2 days to fix

        File financial.js has 698 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        var error = require('./utils/error');
        var dateTime = require('./date-time');
        var utils = require('./utils/common');
        
        function validDate(d) {
        Severity: Major
        Found in lib/financial.js - About 1 day to fix

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

            if (to === null) {
              var to_binary_prefix = binary_prefixes[to_unit.substring(0, 2)];
              var to_unit_prefix = unit_prefixes[to_unit.substring(0, 1)];
          
              // Handle dekao unit prefix (only unit prefix with two characters)
          Severity: Major
          Found in lib/engineering.js and 1 other location - About 1 day to fix
          lib/engineering.js on lines 529..554

          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 280.

          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

            if (from === null) {
              var from_binary_prefix = binary_prefixes[from_unit.substring(0, 2)];
              var from_unit_prefix = unit_prefixes[from_unit.substring(0, 1)];
          
              // Handle dekao unit prefix (only unit prefix with two characters)
          Severity: Major
          Found in lib/engineering.js and 1 other location - About 1 day to fix
          lib/engineering.js on lines 557..582

          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 280.

          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.DEC2OCT = function(number, places) {
            number = utils.parseNumber(number);
            if (number instanceof Error) {
              return number;
            }
          Severity: Major
          Found in lib/engineering.js and 1 other location - About 1 day to fix
          lib/engineering.js on lines 639..678

          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 278.

          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.DEC2HEX = function(number, places) {
            number = utils.parseNumber(number);
            if (number instanceof Error) {
              return number;
            }
          Severity: Major
          Found in lib/engineering.js and 1 other location - About 1 day to fix
          lib/engineering.js on lines 680..719

          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 278.

          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.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: Major
          Found in lib/engineering.js and 1 other location - About 1 day to fix
          lib/engineering.js on lines 70..105

          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 271.

          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.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: Major
          Found in lib/engineering.js and 1 other location - About 1 day to fix
          lib/engineering.js on lines 107..142

          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 271.

          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 CONVERT has 247 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.CONVERT = function(number, from_unit, to_unit) {
            number = utils.parseNumber(number);
            if (number instanceof Error) {
              return number;
            }
          Severity: Major
          Found in lib/engineering.js - About 1 day to fix

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

            exports.IMSINH = function(inumber) {
              // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
              var x = exports.IMREAL(inumber);
              var y = exports.IMAGINARY(inumber);
            
            
            Severity: Major
            Found in lib/engineering.js and 2 other locations - About 1 day to fix
            lib/engineering.js on lines 1033..1048
            lib/engineering.js on lines 1298..1313

            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 217.

            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 3 locations. Consider refactoring.
            Open

            exports.IMSIN = function(inumber) {
              // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
              var x = exports.IMREAL(inumber);
              var y = exports.IMAGINARY(inumber);
            
            
            Severity: Major
            Found in lib/engineering.js and 2 other locations - About 1 day to fix
            lib/engineering.js on lines 1033..1048
            lib/engineering.js on lines 1315..1330

            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 217.

            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 3 locations. Consider refactoring.
            Open

            exports.IMCOSH = function(inumber) {
              // Lookup real and imaginary coefficients using exports.js [http://formulajs.org]
              var x = exports.IMREAL(inumber);
              var y = exports.IMAGINARY(inumber);
            
            
            Severity: Major
            Found in lib/engineering.js and 2 other locations - About 1 day to fix
            lib/engineering.js on lines 1298..1313
            lib/engineering.js on lines 1315..1330

            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 217.

            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.DSTDEV = function(database, field, criteria) {
              // Return error if field is not a number and not a string
              if (isNaN(field) && (typeof field !== "string")) {
                return error.value;
              }
            Severity: Major
            Found in lib/database.js and 1 other location - About 1 day to fix
            lib/database.js on lines 306..329

            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 207.

            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.DSTDEVP = function(database, field, criteria) {
              // Return error if field is not a number and not a string
              if (isNaN(field) && (typeof field !== "string")) {
                return error.value;
              }
            Severity: Major
            Found in lib/database.js and 1 other location - About 1 day to fix
            lib/database.js on lines 282..304

            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 207.

            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.IMLOG10 = function(inumber) {
              // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
              var x = exports.IMREAL(inumber);
              var y = exports.IMAGINARY(inumber);
            
            
            Severity: Major
            Found in lib/engineering.js and 1 other location - About 1 day to fix
            lib/engineering.js on lines 1146..1161

            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 205.

            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.IMLOG2 = function(inumber) {
              // Lookup real and imaginary coefficients using Formula.js [http://formulajs.org]
              var x = exports.IMREAL(inumber);
              var y = exports.IMAGINARY(inumber);
            
            
            Severity: Major
            Found in lib/engineering.js and 1 other location - About 1 day to fix
            lib/engineering.js on lines 1129..1144

            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 205.

            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.DMIN = function(database, field, criteria) {
              // Return error if field is not a number and not a string
              if (isNaN(field) && (typeof field !== "string")) {
                return error.value;
              }
            Severity: Major
            Found in lib/database.js and 1 other location - About 1 day to fix
            lib/database.js on lines 197..221

            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 202.

            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.DMAX = function(database, field, criteria) {
              // Return error if field is not a number and not a string
              if (isNaN(field) && (typeof field !== "string")) {
                return error.value;
              }
            Severity: Major
            Found in lib/database.js and 1 other location - About 1 day to fix
            lib/database.js on lines 223..248

            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 202.

            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

            Severity
            Category
            Status
            Source
            Language