hoverinc/ray-tracing-renderer

View on GitHub

Showing 82 of 82 total issues

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

function load(loader, url) {
  return new Promise(resolve => {
    const l = new loader();
    l.load(url, resolve, undefined, exception => { throw exception; });
  });
Severity: Major
Found in scenes/webgl-comparison/main.js and 1 other location - About 1 hr to fix
scenes/sample-models/main.js on lines 98..103

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

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

function load(loader, url) {
  return new Promise(resolve => {
    const l = new loader();
    l.load(url, resolve, undefined, exception => { throw exception; });
  });
Severity: Major
Found in scenes/sample-models/main.js and 1 other location - About 1 hr to fix
scenes/webgl-comparison/main.js on lines 176..181

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

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

function makeRenderPassFromProgram(gl, program) {

  const uniformSetter = makeUniformSetter(gl, program);

  const textures = {};
Severity: Minor
Found in src/renderer/RenderPass.js - About 55 mins 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 interleave has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function interleave(...arrays) {
  let maxLength = 0;
  for (let i = 0; i < arrays.length; i++) {
    const a = arrays[i];
    const l = a.data ? a.data.length / a.channels : 0;
Severity: Minor
Found in src/renderer/MaterialBuffer.js - About 55 mins 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 setData has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

function setData(dataView, setter, size, offset, stride, components, value) {
Severity: Major
Found in src/renderer/UniformBuffer.js - About 50 mins to fix

    Function makeRenderPassFromScene has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function makeRenderPassFromScene({
        bounces,
        decomposedScene,
        fullscreenQuad,
        gl,
    Severity: Minor
    Found in src/renderer/RayTracePass.js - About 45 mins 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 makeStratifiedSamplerCombined has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function makeStratifiedSamplerCombined(strataCount, listOfDimensions) {
      const strataObjs = [];
    
      for (const dim of listOfDimensions) {
        strataObjs.push(makeStratifiedSampler(strataCount, dim));
    Severity: Minor
    Found in src/renderer/StratifiedSamplerCombined.js - About 45 mins 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 renderTile has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      function renderTile(buffer, x, y, width, height) {
    Severity: Minor
    Found in src/renderer/RenderingPipeline.js - About 35 mins to fix

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

      function getTextureFormat(gl, channels, storage, data, gammaCorrection) {
      Severity: Minor
      Found in src/renderer/Texture.js - About 35 mins to fix

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

        export function equirectangularToSpherical(x, y, width, height, target) {
        Severity: Minor
        Found in src/renderer/envMapCreation.js - About 35 mins to fix

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

          export function unrollLoop(indexName, start, limit, step, code) {
          Severity: Minor
          Found in src/renderer/glslUtil.js - About 35 mins to fix

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

            export function nthElement(array, compare, left = 0, right = array.length, k = Math.floor((left + right) / 2)) {
            Severity: Minor
            Found in src/renderer/bvhUtil.js - About 35 mins to fix

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

                function setUniform(name, v0, v1, v2, v3) {
              Severity: Minor
              Found in src/renderer/UniformSetter.js - About 35 mins to fix

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

                export function createProgram(gl, vertexShader, fragmentShader, transformVaryings, transformBufferMode) {
                Severity: Minor
                Found in src/renderer/glUtil.js - About 35 mins to fix

                  Function makeFramebuffer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function makeFramebuffer(gl, { color, depth }) {
                  
                    const framebuffer = gl.createFramebuffer();
                  
                    function bind() {
                  Severity: Minor
                  Found in src/renderer/Framebuffer.js - About 35 mins 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 makeRayTracePass has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function makeRayTracePass(gl, {
                      bounces, // number of global illumination bounces
                      decomposedScene,
                      fullscreenQuad,
                      materialBuffer,
                  Severity: Minor
                  Found in src/renderer/RayTracePass.js - About 35 mins 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

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

                      { data: [].concat(...bufferData.color.map(d => d.toArray())), channels: 3 },
                  Severity: Minor
                  Found in src/renderer/MaterialBuffer.js and 1 other location - About 35 mins to fix
                  src/renderer/MaterialBuffer.js on lines 136..136

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

                  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

                      { data: [].concat(...bufferData.normalScale.map(d => d.toArray())), channels: 2 }
                  Severity: Minor
                  Found in src/renderer/MaterialBuffer.js and 1 other location - About 35 mins to fix
                  src/renderer/MaterialBuffer.js on lines 129..129

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

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

                  export function nthElement(array, compare, left = 0, right = array.length, k = Math.floor((left + right) / 2)) {
                    for (let i = left; i <= k; i++) {
                      let minIndex = i;
                      let minValue = array[i];
                      for (let j = i + 1; j < right; j++) {
                  Severity: Minor
                  Found in src/renderer/bvhUtil.js - About 25 mins 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 maximumExtent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function maximumExtent(box3) {
                    box3.getSize(size);
                    if (size.x > size.z) {
                      return size.x > size.y ? 'x' : 'y';
                    } else {
                  Severity: Minor
                  Found in src/renderer/bvhAccel.js - About 25 mins 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

                  Severity
                  Category
                  Status
                  Source
                  Language