hoverinc/ray-tracing-renderer

View on GitHub
src/renderer/bvhAccel.js

Summary

Maintainability
D
1 day
Test Coverage
F
0%

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

    export function flattenBvh(bvh) {
      const flat = [];
      const isBounds = [];
    
      const splitAxisMap = {
    Severity: Major
    Found in src/renderer/bvhAccel.js - About 2 hrs to fix

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

      function makePrimitiveInfo(geometry) {
        const primitiveInfo = [];
        const indices = geometry.getIndex().array;
        const position = geometry.getAttribute('position');
        const materialMeshIndex = geometry.getAttribute('materialMeshIndex');
      Severity: Minor
      Found in src/renderer/bvhAccel.js - About 1 hr to fix

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

        export function flattenBvh(bvh) {
          const flat = [];
          const isBounds = [];
        
          const splitAxisMap = {
        Severity: Minor
        Found in src/renderer/bvhAccel.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 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

        There are no issues that match your filters.

        Category
        Status