deps/v8/benchmarks/navier-stokes.js

Summary

Maintainability
F
6 days
Test Coverage

Function FluidField has a Cognitive Complexity of 104 (exceeds 5 allowed). Consider refactoring.
Open

function FluidField(canvas) {
    function addFields(x, s, dt)
    {
        for (var i=0; i<size ; i++ ) x[i] += dt*s[i];
    }
Severity: Minor
Found in deps/v8/benchmarks/navier-stokes.js - About 2 days 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 FluidField has 285 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function FluidField(canvas) {
    function addFields(x, s, dt)
    {
        for (var i=0; i<size ; i++ ) x[i] += dt*s[i];
    }
Severity: Major
Found in deps/v8/benchmarks/navier-stokes.js - About 1 day to fix

    File navier-stokes.js has 333 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * Copyright 2012 the V8 project authors. All rights reserved.
     * Copyright 2009 Oliver Hunt <http://nerget.com>
     *
     * Permission is hereby granted, free of charge, to any person
    Severity: Minor
    Found in deps/v8/benchmarks/navier-stokes.js - About 4 hrs to fix

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

          function set_bnd(b, x)
          {
              if (b===1) {
                  for (var i = 1; i <= width; i++) {
                      x[i] =  x[i + rowSize];
      Severity: Minor
      Found in deps/v8/benchmarks/navier-stokes.js - About 1 hr to fix

        Function project has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function project(u, v, p, div)
            {
                var h = -0.5 / Math.sqrt(width * height);
                for (var j = 1 ; j <= height; j++ ) {
                    var row = j * rowSize;
        Severity: Minor
        Found in deps/v8/benchmarks/navier-stokes.js - About 1 hr to fix

          Function lin_solve2 has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function lin_solve2(x, x0, y, y0, a, c)
              {
                  if (a === 0 && c === 1) {
                      for (var j=1 ; j <= height; j++) {
                          var currentRow = j * rowSize;
          Severity: Minor
          Found in deps/v8/benchmarks/navier-stokes.js - About 1 hr to fix

            Function advect has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function advect(b, d, d0, u, v, dt)
                {
                    var Wdt0 = dt * width;
                    var Hdt0 = dt * height;
                    var Wp5 = width + 0.5;
            Severity: Minor
            Found in deps/v8/benchmarks/navier-stokes.js - About 1 hr to fix

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

                  function advect(b, d, d0, u, v, dt)
              Severity: Minor
              Found in deps/v8/benchmarks/navier-stokes.js - About 45 mins to fix

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

                    function lin_solve2(x, x0, y, y0, a, c)
                Severity: Minor
                Found in deps/v8/benchmarks/navier-stokes.js - About 45 mins to fix

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

                      function dens_step(x, x0, u, v, dt)
                  Severity: Minor
                  Found in deps/v8/benchmarks/navier-stokes.js - About 35 mins to fix

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

                        function diffuse2(x, x0, y, y0, dt)
                    Severity: Minor
                    Found in deps/v8/benchmarks/navier-stokes.js - About 35 mins to fix

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

                          function vel_step(u, v, u0, v0, dt)
                      Severity: Minor
                      Found in deps/v8/benchmarks/navier-stokes.js - About 35 mins to fix

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

                            function lin_solve(b, x, x0, a, c)
                        Severity: Minor
                        Found in deps/v8/benchmarks/navier-stokes.js - About 35 mins to fix

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

                                      for (var j = 1; j <= height; j++) {
                                          x[j * rowSize] =  x[1 + j * rowSize];
                                          x[(width + 1) + j * rowSize] =  x[width + j * rowSize];
                                      }
                          Severity: Major
                          Found in deps/v8/benchmarks/navier-stokes.js and 1 other location - About 2 hrs to fix
                          deps/v8/benchmarks/navier-stokes.js on lines 116..119

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

                          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

                                      for (var j = 1; j <= height; j++) {
                                          x[j * rowSize] =  x[1 + j * rowSize];
                                          x[(width + 1) + j * rowSize] =  x[width + j * rowSize];
                                      }
                          Severity: Major
                          Found in deps/v8/benchmarks/navier-stokes.js and 1 other location - About 2 hrs to fix
                          deps/v8/benchmarks/navier-stokes.js on lines 106..109

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

                          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

                                      for (var i = 1; i <= width; i++) {
                                          x[i] =  x[i + rowSize];
                                          x[i + (height+1) *rowSize] = x[i + height * rowSize];
                                      }
                          Severity: Major
                          Found in deps/v8/benchmarks/navier-stokes.js and 1 other location - About 2 hrs to fix
                          deps/v8/benchmarks/navier-stokes.js on lines 111..114

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

                          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

                                      for (var i = 1; i <= width; i++) {
                                          x[i] =  x[i + rowSize];
                                          x[i + (height + 1) * rowSize] = x[i + height * rowSize];
                                      }
                          Severity: Major
                          Found in deps/v8/benchmarks/navier-stokes.js and 1 other location - About 2 hrs to fix
                          deps/v8/benchmarks/navier-stokes.js on lines 91..94

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

                          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

                                                  lastY = y[currentRow] = (y0[currentRow] + a * (lastY + y[++currentRow] + y[++lastRow] + y[++nextRow])) * invC;
                          Severity: Major
                          Found in deps/v8/benchmarks/navier-stokes.js and 1 other location - About 1 hr to fix
                          deps/v8/benchmarks/navier-stokes.js on lines 150..150

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

                          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

                                                  lastX = x[currentRow] = (x0[currentRow] + a*(lastX+x[++currentRow]+x[++lastRow]+x[++nextRow])) * invC;
                          Severity: Major
                          Found in deps/v8/benchmarks/navier-stokes.js and 1 other location - About 1 hr to fix
                          deps/v8/benchmarks/navier-stokes.js on lines 189..189

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

                          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

                          There are no issues that match your filters.

                          Category
                          Status