karimsa/solver.js

View on GitHub

Showing 26 of 26 total issues

Function exports has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    module.exports = function (options, callback) {
        // defaults
        options = options || {};
        options.type = options.type || 'linear';
        options.indep = options.indep || 'x';
Severity: Major
Found in lib/dataset/createSolver.js - About 2 hrs to fix

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

    module.exports = (function () {
        "use strict";
    
        // Continous integration using
        // Riemann's sum.
    Severity: Minor
    Found in lib/math/integration.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 exports has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        module.exports = function (type) {
            var reqs = sRequired[type],
                sums = {},
                n = 0,
                collect = function (sol) {
    Severity: Major
    Found in lib/dataset/createSolverStream.js - About 2 hrs to fix

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

                          tanb = (data.y[Q[3]] - data.y[Q[3] + 1]) / (data.x[Q[3]] - data.x[Q[3] + 1]);
      Severity: Major
      Found in lib/dataset/createSolver.js and 1 other location - About 1 hr to fix
      lib/dataset/createSolver.js on lines 55..55

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

      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

                          tana = (data.y[Q[1]] - data.y[Q[1] + 1]) / (data.x[Q[1]] - data.x[Q[1] + 1]);
      Severity: Major
      Found in lib/dataset/createSolver.js and 1 other location - About 1 hr to fix
      lib/dataset/createSolver.js on lines 58..58

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

      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 exports has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function () {
          "use strict";
      
          var i, x, data = this,
              Data = this.construct();
      Severity: Minor
      Found in lib/data/summary.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 Probability has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              Probability = function (map, match) {
                  var that = this;
      
                  // the event map should be an array,
                  // let's convert it to an object
      Severity: Minor
      Found in lib/probability/map.js - About 1 hr to fix

        Function exports has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = function (data) {
            "use strict";
        
            var e, i, o = {},
                toData = require('../../data.js'),
        Severity: Minor
        Found in lib/eq/solvers/linear.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 exports has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function () {
            "use strict";
        
            var i, x, data = this,
                Data = this.construct();
        Severity: Minor
        Found in lib/data/summary.js - About 1 hr to fix

          Function exports has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function (n) {
              "use strict";
          
              // .constant()
              // Converts a given number into an object that
          Severity: Minor
          Found in lib/math/constant.js - About 1 hr to fix

            Function exports has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function (data) {
                "use strict";
            
                var e, i, o = {},
                    toData = require('../../data.js'),
            Severity: Minor
            Found in lib/eq/solvers/linear.js - About 1 hr to fix

              Function stream has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          this.stream = mapstream(function (occured, next) {
                              // occured can be a map of frequencies, or
                              // an array of events
                              var i, j, k = false,
                                  fmap = {};
              Severity: Minor
              Found in lib/probability/map.js - About 1 hr to fix

                Function exports has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = (function () {
                    "use strict";
                
                    // Continous integration using
                    // Riemann's sum.
                Severity: Minor
                Found in lib/math/integration.js - About 1 hr to fix

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

                  module.exports = function (data) {
                      "use strict";
                  
                      var e, o = {},
                          toData = require('../../data.js'),
                  Severity: Minor
                  Found in lib/eq/solvers/exponential.js - About 1 hr to fix

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

                            x = toData(data.x.val[0].average ? data.x.val[0] : data.x.val),
                    Severity: Major
                    Found in lib/eq/solvers/exponential.js and 3 other locations - About 50 mins to fix
                    lib/eq/solvers/exponential.js on lines 13..13
                    lib/eq/solvers/linear.js on lines 12..12
                    lib/eq/solvers/linear.js on lines 13..13

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

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

                            y = toData(data.y.val[0].average ? data.y.val[0] : data.y.val),
                    Severity: Major
                    Found in lib/eq/solvers/exponential.js and 3 other locations - About 50 mins to fix
                    lib/eq/solvers/exponential.js on lines 12..12
                    lib/eq/solvers/linear.js on lines 12..12
                    lib/eq/solvers/linear.js on lines 13..13

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

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

                            y = toData(data.y.val[0].average ? data.y.val[0] : data.y.val),
                    Severity: Major
                    Found in lib/eq/solvers/linear.js and 3 other locations - About 50 mins to fix
                    lib/eq/solvers/exponential.js on lines 12..12
                    lib/eq/solvers/exponential.js on lines 13..13
                    lib/eq/solvers/linear.js on lines 12..12

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

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

                            x = toData(data.x.val[0].average ? data.x.val[0] : data.x.val),
                    Severity: Major
                    Found in lib/eq/solvers/linear.js and 3 other locations - About 50 mins to fix
                    lib/eq/solvers/exponential.js on lines 12..12
                    lib/eq/solvers/exponential.js on lines 13..13
                    lib/eq/solvers/linear.js on lines 13..13

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

                    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

                    Avoid deeply nested control flow statements.
                    Open

                                                    if (that.equal(i, map[j])) {
                                                        that.map[map[j]] += fmap[i];
                                                        k = true;
                                                        break;
                                                    }
                    Severity: Major
                    Found in lib/probability/map.js - About 45 mins to fix

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

                          o.text = data.y.name + ' = ' + ((+o.a) === 1 ? '' : o.a) + data.x.name + ((+o.n) === 0 ? '' : ('^' + o.n));
                      Severity: Minor
                      Found in lib/eq/solvers/exponential.js and 1 other location - About 45 mins to fix
                      lib/eq/solvers/linear.js on lines 39..39

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

                      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