hoverinc/ray-tracing-renderer

View on GitHub

Showing 82 of 82 total issues

Function init has 159 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function init() {
  const envmap = new THREE.RGBELoader().load('envmap.hdr');
  const envLight = new THREE.EnvironmentLight(envmap);
  scene.add(envLight);

Severity: Major
Found in scenes/renderer-test/main.js - About 6 hrs to fix

    Function makeRenderingPipeline has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

    export function makeRenderingPipeline({
        gl,
        optionalExtensions,
        scene,
        toneMappingParams,
    Severity: Minor
    Found in src/renderer/RenderingPipeline.js - About 6 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 recursiveBuild has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

    function recursiveBuild(primitiveInfo, start, end) {
      const bounds = new Box3();
      for (let i = start; i < end; i++) {
        bounds.union(primitiveInfo[i].bounds);
      }
    Severity: Minor
    Found in src/renderer/bvhAccel.js - About 5 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 RayTracingRenderer has 120 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function RayTracingRenderer(params = {}) {
      const canvas = params.canvas || document.createElement('canvas');
    
      const gl = canvas.getContext('webgl2', {
        alpha: false,
    Severity: Major
    Found in src/RayTracingRenderer.js - About 4 hrs to fix

      Function RayTracingRenderer has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

      export function RayTracingRenderer(params = {}) {
        const canvas = params.canvas || document.createElement('canvas');
      
        const gl = canvas.getContext('webgl2', {
          alpha: false,
      Severity: Minor
      Found in src/RayTracingRenderer.js - About 4 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

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

      import { decomposeScene } from './decomposeScene';
      import { makeFramebuffer } from './Framebuffer';
      import { makeFullscreenQuad } from './FullscreenQuad';
      import { makeGBufferPass } from './GBufferPass';
      import { makeMaterialBuffer } from './MaterialBuffer';
      Severity: Minor
      Found in src/renderer/RenderingPipeline.js - About 4 hrs to fix

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

          {
            const mesh = makeMesh();
            mesh.position.setX(-15);
            mesh.position.setZ(15);
            mesh.material.roughness = 0.0;
        Severity: Major
        Found in scenes/renderer-test/main.js and 1 other location - About 3 hrs to fix
        scenes/renderer-test/main.js on lines 86..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 109.

        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

          {
            const mesh = makeMesh();
            mesh.position.setX(-5);
            mesh.position.setZ(15);
            mesh.material.roughness = 1.0;
        Severity: Major
        Found in scenes/renderer-test/main.js and 1 other location - About 3 hrs to fix
        scenes/renderer-test/main.js on lines 75..83

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

        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

          {
            const mesh = makeMesh();
            mesh.position.setX(5);
            mesh.position.setZ(15);
            mesh.material.roughness = 0.0;
        Severity: Major
        Found in scenes/renderer-test/main.js and 1 other location - About 3 hrs to fix
        scenes/renderer-test/main.js on lines 108..116

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

        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

          {
            const mesh = makeMesh();
            mesh.position.setX(15);
            mesh.position.setZ(15);
            mesh.material.roughness = 1.0;
        Severity: Major
        Found in scenes/renderer-test/main.js and 1 other location - About 3 hrs to fix
        scenes/renderer-test/main.js on lines 97..105

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

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

        function resize() {
          if (renderer.domElement.parentElement) {
            const width = renderer.domElement.parentElement.clientWidth;
            const height = renderer.domElement.parentElement.clientHeight;
            renderer.setSize(width, height);
        Severity: Major
        Found in scenes/webgl-comparison/main.js and 2 other locations - About 3 hrs to fix
        scenes/renderer-test/main.js on lines 27..36
        scenes/sample-models/main.js on lines 75..84

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

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

        function resize() {
          if (renderer.domElement.parentElement) {
            const width = renderer.domElement.parentElement.clientWidth;
            const height = renderer.domElement.parentElement.clientHeight;
            renderer.setSize(width, height);
        Severity: Major
        Found in scenes/renderer-test/main.js and 2 other locations - About 3 hrs to fix
        scenes/sample-models/main.js on lines 75..84
        scenes/webgl-comparison/main.js on lines 64..73

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

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

        function resize() {
          if (renderer.domElement.parentElement) {
            const width = renderer.domElement.parentElement.clientWidth;
            const height = renderer.domElement.parentElement.clientHeight;
            renderer.setSize(width, height);
        Severity: Major
        Found in scenes/sample-models/main.js and 2 other locations - About 3 hrs to fix
        scenes/renderer-test/main.js on lines 27..36
        scenes/webgl-comparison/main.js on lines 64..73

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

        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

          if (maps.normalMap.textures.length > 0) {
            const { relativeSizes, texture } = makeTextureArray(gl, maps.normalMap.textures, false);
            textures.normalMap = texture;
            bufferData.normalMapSize = relativeSizes;
            bufferData.normalMapIndex = maps.normalMap.indices;
        Severity: Major
        Found in src/renderer/MaterialBuffer.js and 1 other location - About 3 hrs to fix
        src/renderer/MaterialBuffer.js on lines 30..35

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

        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

          if (maps.map.textures.length > 0) {
            const { relativeSizes, texture } = makeTextureArray(gl, maps.map.textures, true);
            textures.diffuseMap = texture;
            bufferData.diffuseMapSize = relativeSizes;
            bufferData.diffuseMapIndex = maps.map.indices;
        Severity: Major
        Found in src/renderer/MaterialBuffer.js and 1 other location - About 3 hrs to fix
        src/renderer/MaterialBuffer.js on lines 37..42

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

        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 recursiveBuild has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function recursiveBuild(primitiveInfo, start, end) {
          const bounds = new Box3();
          for (let i = start; i < end; i++) {
            bounds.union(primitiveInfo[i].bounds);
          }
        Severity: Major
        Found in src/renderer/bvhAccel.js - About 2 hrs to fix

          Function makeTexture has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

          export function makeTexture(gl, params) {
            let {
              width = null,
              height = null,
          
          
          Severity: Minor
          Found in src/renderer/Texture.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 makeUniformSetter has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          export function makeUniformSetter(gl, program) {
            const uniformInfo = getUniforms(gl, program);
            const uniforms = {};
            const needsUpload = [];
          
          
          Severity: Minor
          Found in src/renderer/UniformSetter.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 makeTileRender has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function makeTileRender(gl) {
            const desiredMsPerTile = 21;
          
            let currentTile = -1;
            let numTiles = 1;
          Severity: Major
          Found in src/renderer/TileRender.js - About 2 hrs to fix

            Function makeTexture has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function makeTexture(gl, params) {
              let {
                width = null,
                height = null,
            
            
            Severity: Major
            Found in src/renderer/Texture.js - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language