Hi-Level/three-csg

View on GitHub

Showing 8 of 52 total issues

Function toGeometry has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

  static toGeometry(csg: CSG, toMatrix: Matrix4): BufferGeometry {
    let triCount = 0;
    const ps = csg.polygons;
    for (const p of ps) {
      triCount += p.vertices.length - 2;
Severity: Minor
Found in src/CSG.ts - 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

Function splitPolygon has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

  splitPolygon(
    polygon: Polygon,
    coplanarFront: Polygon[],
    coplanarBack: Polygon[],
    front: Polygon[],
Severity: Minor
Found in src/Plane.ts - 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

Function toGeometry has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  static toGeometry(csg: CSG, toMatrix: Matrix4): BufferGeometry {
    let triCount = 0;
    const ps = csg.polygons;
    for (const p of ps) {
      triCount += p.vertices.length - 2;
Severity: Major
Found in src/CSG.ts - About 2 hrs to fix

    Function fromGeometry has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      static fromGeometry(geom: BufferGeometry, objectIndex?: any): CSG {
        let polys = [];
        const posattr = geom.attributes.position;
        const normalattr = geom.attributes.normal;
        const uvattr = geom.attributes.uv;
    Severity: Minor
    Found in src/CSG.ts - 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 fromGeometry has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      static fromGeometry(geom: BufferGeometry, objectIndex?: any): CSG {
        let polys = [];
        const posattr = geom.attributes.position;
        const normalattr = geom.attributes.normal;
        const uvattr = geom.attributes.uv;
    Severity: Major
    Found in src/CSG.ts - About 2 hrs to fix

      File CSG.ts has 252 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import {
        BufferAttribute,
        BufferGeometry,
        Material,
        Matrix3,
      Severity: Minor
      Found in src/CSG.ts - About 2 hrs to fix

        Function splitPolygon has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          splitPolygon(
            polygon: Polygon,
            coplanarFront: Polygon[],
            coplanarBack: Polygon[],
            front: Polygon[],
        Severity: Major
        Found in src/Plane.ts - About 2 hrs to fix

          Function build has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            build(polygons: Polygon[]): void {
              if (!polygons.length) return;
              if (!this.plane) this.plane = polygons[0].plane.clone();
              const front = [],
                back = [];
          Severity: Minor
          Found in src/Node.ts - 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

          Severity
          Category
          Status
          Source
          Language