thi-ng/umbrella

View on GitHub
packages/geom-tessellate/src/earcut-complex.ts

Summary

Maintainability
D
1 day
Test Coverage

File earcut-complex.ts has 524 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

import type { Nullable, Predicate } from "@thi.ng/api";
import { bounds2 } from "@thi.ng/geom-poly-utils/bounds";
import { sign } from "@thi.ng/math/abs";
import { mux2 } from "@thi.ng/morton/mux";
import type { ReadonlyVec } from "@thi.ng/vectors";
Severity: Major
Found in packages/geom-tessellate/src/earcut-complex.ts - About 1 day to fix

Function __findHoleBridge has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

const __findHoleBridge = (hole: Vertex, outer: Vertex): Nullable<Vertex> => {
    const { x: hx, y: hy } = hole;
    let v = outer;
    let qx = -Infinity;
    let px: number, py: number;
Severity: Minor
Found in packages/geom-tessellate/src/earcut-complex.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 __sortLinked has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

const __sortLinked = (list: Nullable<Vertex>) => {
    let numMerges;
    let inSize = 1;

    do {
Severity: Minor
Found in packages/geom-tessellate/src/earcut-complex.ts - About 3 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 __triBounds has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Wontfix

const __triBounds = (
    ax: number,
    ay: number,
    bx: number,
    by: number,
Severity: Minor
Found in packages/geom-tessellate/src/earcut-complex.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 earCutComplex has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    (holeIDs: number[] = [], hashThreshold = 80): Tessellator =>
    (tess, faces, pids) => {
        let points = tess.pointsForIDs(pids);
        const hasHoles = !!holeIDs.length;
        const outerLen = hasHoles ? holeIDs[0] : points.length;
Severity: Minor
Found in packages/geom-tessellate/src/earcut-complex.ts - 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 __earcutLinked has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

const __earcutLinked = (
    ear: Nullable<Vertex>,
    triangles: number[][],
    pred: Predicate<Vertex>,
    pass = 0
Severity: Minor
Found in packages/geom-tessellate/src/earcut-complex.ts - 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 __isEarHashed has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

const __isEarHashed = (ear: Vertex) => {
    const { p: a, n: c } = ear;
    const b = ear;
    // reflex, can't be an ear
    if (__area(a!, b, c!) >= 0) return false;
Severity: Minor
Found in packages/geom-tessellate/src/earcut-complex.ts - 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 __removeColinear has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Wontfix

const __removeColinear = (start: Nullable<Vertex>, end = start) => {
    if (!start) return start;
    let v = start;
    let repeat: boolean;
    do {
Severity: Minor
Found in packages/geom-tessellate/src/earcut-complex.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

Function __buildVertexList has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Wontfix

const __buildVertexList = (
    points: ReadonlyVec[],
    pids: number[],
    start: number,
    end: number,
Severity: Minor
Found in packages/geom-tessellate/src/earcut-complex.ts - 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

Consider simplifying this complex logical expression.
Open

            if (
                __isLocallyInside(v, hole) &&
                (tan < tanMin ||
                    (tan === tanMin &&
                        (px > m.x ||
Severity: Major
Found in packages/geom-tessellate/src/earcut-complex.ts - About 40 mins to fix

Avoid too many return statements within this function.
Wontfix

    return true;
Severity: Major
Found in packages/geom-tessellate/src/earcut-complex.ts - About 30 mins to fix

Avoid too many return statements within this function.
Wontfix

    return false;
Severity: Major
Found in packages/geom-tessellate/src/earcut-complex.ts - About 30 mins to fix

Avoid too many return statements within this function.
Wontfix

    if (o4 === 0 && __onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2
Severity: Major
Found in packages/geom-tessellate/src/earcut-complex.ts - About 30 mins to fix

Function __eliminateHoles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Wontfix

const __eliminateHoles = (
    points: ReadonlyVec[],
    pids: number[],
    holeIndices: number[],
    outerNode: Vertex
Severity: Minor
Found in packages/geom-tessellate/src/earcut-complex.ts - 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 __splitEarcut has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Wontfix

const __splitEarcut = (
    start: Vertex,
    triangles: number[][],
    pred: Predicate<Vertex>
) => {
Severity: Minor
Found in packages/geom-tessellate/src/earcut-complex.ts - 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