jpweeks/particulate-js

View on GitHub

Showing 6 of 9 total issues

Function applyConstraint has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

AngleConstraint.prototype.applyConstraint = function (index, p0, p1) {
  /*jshint maxcomplexity:15*/

  var ii = this.indices
  var ai = ii[index], bi = ii[index + 1], ci = ii[index + 2]
Severity: Major
Found in src/constraints/AngleConstraint.js - About 3 hrs to fix

    Function _calculateNormal has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    PlaneConstraint.prototype._calculateNormal = function (index, p0) {
      var b0 = this.bufferVec3
      var ii = this.indices
      var ai = ii[0], bi = ii[1], ci = ii[2]
    
    
    Severity: Minor
    Found in src/constraints/PlaneConstraint.js - About 1 hr to fix

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

      AngleConstraint.prototype.applyConstraint = function (index, p0, p1) {
        /*jshint maxcomplexity:15*/
      
        var ii = this.indices
        var ai = ii[index], bi = ii[index + 1], ci = ii[index + 2]
      Severity: Minor
      Found in src/constraints/AngleConstraint.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 applyForce has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      PointForce.prototype.applyForce = function (ix, f0, p0, p1) {
        var v0 = this.vector
        var iy = ix + 1
        var iz = ix + 2
      
      
      Severity: Minor
      Found in src/forces/PointForce.js - About 1 hr to fix

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

        function ps_integrateParticle(i, p0, p1, f0, weight, d2) {
        Severity: Minor
        Found in src/systems/ParticleSystem.js - About 45 mins to fix

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

          Vec3.set = function (b0, i, x, y, z) {
          Severity: Minor
          Found in src/math/Vec3.js - About 35 mins to fix
            Severity
            Category
            Status
            Source
            Language