BabylonJS/Spector.js

View on GitHub
sample/js/simple.js

Summary

Maintainability
F
1 wk
Test Coverage

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

function initBuffers() {

  // Create a buffer for the cube's vertices.

  cubeVerticesBuffer = gl.createBuffer();
Severity: Major
Found in sample/js/simple.js - About 2 hrs to fix

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

    function drawScene() {
      // Clear the canvas before we start drawing on it.
      gl.clearColor(0, 0.5 + 0.1 * Math.random(1), 0, 1);
      gl.clearDepth(1.0);
      gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
    Severity: Minor
    Found in sample/js/simple.js - About 1 hr to fix

      Identical blocks of code found in 11 locations. Consider refactoring.
      Open

      function initBuffers() {
      
        // Create a buffer for the cube's vertices.
      
        cubeVerticesBuffer = gl.createBuffer();
      Severity: Major
      Found in sample/js/simple.js and 10 other locations - About 3 days to fix
      sample/js/customLog.js on lines 109..219
      sample/js/customMarker.js on lines 109..219
      sample/js/customShaderName.js on lines 111..221
      sample/js/depthRange.js on lines 107..217
      sample/js/scissorClear.js on lines 111..221
      sample/js/setTimeout.js on lines 111..221
      sample/js/simpleNoCommand.js on lines 107..217
      sample/js/stencilBits.js on lines 111..221
      sample/js/transient.js on lines 118..228
      sample/js/uniformCommand.js on lines 109..219

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

      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

      function drawScene() {
        // Clear the canvas before we start drawing on it.
        gl.clearColor(0, 0.5 + 0.1 * Math.random(1), 0, 1);
        gl.clearDepth(1.0);
        gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
      Severity: Major
      Found in sample/js/simple.js and 2 other locations - About 2 days to fix
      sample/js/customMetadata.js on lines 227..300
      sample/js/transient.js on lines 235..308

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

      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

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

      function initShaders() {
        var fragmentShader = getShader(gl, fragmentShaderSource, false);
        var vertexShader = getShader(gl, vertexShaderSource, true);
      
        // Create the shader program
      Severity: Major
      Found in sample/js/simple.js and 3 other locations - About 1 day to fix
      sample/js/scissorClear.js on lines 316..340
      sample/js/setTimeout.js on lines 316..340
      sample/js/stencilBits.js on lines 308..332

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

      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

      Identical blocks of code found in 12 locations. Consider refactoring.
      Open

      function start() {
        canvas = document.getElementById("renderCanvas");
      
        initWebGL(canvas);      // Initialize the GL context
      
      
      Severity: Major
      Found in sample/js/simple.js and 11 other locations - About 6 hrs to fix
      sample/js/customLog.js on lines 52..78
      sample/js/customMarker.js on lines 52..78
      sample/js/customMetadata.js on lines 50..76
      sample/js/customShaderName.js on lines 54..80
      sample/js/depthRange.js on lines 50..76
      sample/js/scissorClear.js on lines 54..80
      sample/js/setTimeout.js on lines 54..80
      sample/js/simpleNoCommand.js on lines 50..76
      sample/js/stencilBits.js on lines 54..80
      sample/js/uniformArray.js on lines 46..72
      sample/js/uniformCommand.js on lines 52..78

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

      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

      Identical blocks of code found in 13 locations. Consider refactoring.
      Open

      function getShader(gl, source, isVertex) {
        var shader = gl.createShader(isVertex ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER);
        gl.shaderSource(shader, source);
        gl.compileShader(shader);
      
      
      Severity: Major
      Found in sample/js/simple.js and 12 other locations - About 4 hrs to fix
      sample/js/customLog.js on lines 340..353
      sample/js/customMarker.js on lines 341..354
      sample/js/customMetadata.js on lines 342..355
      sample/js/customShaderName.js on lines 338..351
      sample/js/depthRange.js on lines 345..358
      sample/js/scissorClear.js on lines 346..359
      sample/js/setTimeout.js on lines 346..359
      sample/js/simpleNoCommand.js on lines 334..347
      sample/js/stencilBits.js on lines 338..351
      sample/js/transient.js on lines 345..358
      sample/js/uniformArray.js on lines 297..310
      sample/js/uniformCommand.js on lines 337..350

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

      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

      Identical blocks of code found in 12 locations. Consider refactoring.
      Open

      function setMatrixUniforms() {
        var pUniform = gl.getUniformLocation(shaderProgram, "uPMatrix");
        gl.uniformMatrix4fv(pUniform, false, new Float32Array(perspectiveMatrix.flatten()));
      
        var mvUniform = gl.getUniformLocation(shaderProgram, "uMVMatrix");
      Severity: Major
      Found in sample/js/simple.js and 11 other locations - About 2 hrs to fix
      sample/js/customLog.js on lines 371..377
      sample/js/customMarker.js on lines 372..378
      sample/js/customShaderName.js on lines 369..375
      sample/js/depthRange.js on lines 376..382
      sample/js/scissorClear.js on lines 377..383
      sample/js/setTimeout.js on lines 377..383
      sample/js/simpleNoCommand.js on lines 365..371
      sample/js/stencilBits.js on lines 369..375
      sample/js/transient.js on lines 376..382
      sample/js/uniformArray.js on lines 328..334
      sample/js/uniformCommand.js on lines 368..374

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

      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

      Identical blocks of code found in 12 locations. Consider refactoring.
      Open

      function initWebGL() {
        gl = null;
      
        try {
          gl = canvas.getContext("experimental-webgl");
      Severity: Major
      Found in sample/js/simple.js and 11 other locations - About 2 hrs to fix
      sample/js/customLog.js on lines 86..101
      sample/js/customMarker.js on lines 86..101
      sample/js/customMetadata.js on lines 84..99
      sample/js/customShaderName.js on lines 88..103
      sample/js/depthRange.js on lines 84..99
      sample/js/scissorClear.js on lines 88..103
      sample/js/setTimeout.js on lines 88..103
      sample/js/simpleNoCommand.js on lines 84..99
      sample/js/transient.js on lines 95..110
      sample/js/uniformArray.js on lines 80..95
      sample/js/uniformCommand.js on lines 86..101

      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

      Identical blocks of code found in 13 locations. Consider refactoring.
      Open

      function mvRotate(angle, v) {
        var inRadians = angle * Math.PI / 180.0;
      
        var m = Matrix.Rotation(inRadians, $V([v[0], v[1], v[2]])).ensure4x4();
        multMatrix(m);
      Severity: Major
      Found in sample/js/simple.js and 12 other locations - About 2 hrs to fix
      sample/js/customLog.js on lines 405..410
      sample/js/customMarker.js on lines 406..411
      sample/js/customMetadata.js on lines 403..408
      sample/js/customShaderName.js on lines 403..408
      sample/js/depthRange.js on lines 404..409
      sample/js/scissorClear.js on lines 405..410
      sample/js/setTimeout.js on lines 405..410
      sample/js/simpleNoCommand.js on lines 393..398
      sample/js/stencilBits.js on lines 397..402
      sample/js/transient.js on lines 404..409
      sample/js/uniformArray.js on lines 356..361
      sample/js/uniformCommand.js on lines 402..407

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

      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

      Identical blocks of code found in 13 locations. Consider refactoring.
      Open

      function mvPushMatrix(m) {
        if (m) {
          mvMatrixStack.push(m.dup());
          mvMatrix = m.dup();
        } else {
      Severity: Major
      Found in sample/js/simple.js and 12 other locations - About 1 hr to fix
      sample/js/customLog.js on lines 387..394
      sample/js/customMarker.js on lines 388..395
      sample/js/customMetadata.js on lines 385..392
      sample/js/customShaderName.js on lines 385..392
      sample/js/depthRange.js on lines 386..393
      sample/js/scissorClear.js on lines 387..394
      sample/js/setTimeout.js on lines 387..394
      sample/js/simpleNoCommand.js on lines 375..382
      sample/js/stencilBits.js on lines 379..386
      sample/js/transient.js on lines 386..393
      sample/js/uniformArray.js on lines 338..345
      sample/js/uniformCommand.js on lines 384..391

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

      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

      var vertexShaderSource = "attribute vec3 aVertexPosition;" +
      "attribute vec4 aVertexColor;" +
      
      "uniform mat4 uMVMatrix; // ms({ value: '#ff0000' })\n" +
      "uniform mat4 uPMatrix; // ms({ value: '#ff0000' })\n" +
      Severity: Major
      Found in sample/js/simple.js and 3 other locations - About 50 mins to fix
      sample/js/scissorClear.js on lines 26..41
      sample/js/setTimeout.js on lines 26..41
      sample/js/stencilBits.js on lines 26..41

      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

      Identical blocks of code found in 13 locations. Consider refactoring.
      Open

      function mvTranslate(v) {
        multMatrix(Matrix.Translation($V([v[0], v[1], v[2]])).ensure4x4());
      }
      Severity: Major
      Found in sample/js/simple.js and 12 other locations - About 50 mins to fix
      sample/js/customLog.js on lines 367..369
      sample/js/customMarker.js on lines 368..370
      sample/js/customMetadata.js on lines 369..371
      sample/js/customShaderName.js on lines 365..367
      sample/js/depthRange.js on lines 372..374
      sample/js/scissorClear.js on lines 373..375
      sample/js/setTimeout.js on lines 373..375
      sample/js/simpleNoCommand.js on lines 361..363
      sample/js/stencilBits.js on lines 365..367
      sample/js/transient.js on lines 372..374
      sample/js/uniformArray.js on lines 324..326
      sample/js/uniformCommand.js on lines 364..366

      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

      There are no issues that match your filters.

      Category
      Status