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";
- Create a ticketCreate a ticket
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;
- Read upRead up
- Create a ticketCreate a ticket
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 {
- Read upRead up
- Create a ticketCreate a ticket
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,
- Read upRead up
- Create a ticketCreate a ticket
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;
- Read upRead up
- Create a ticketCreate a ticket
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
- Read upRead up
- Create a ticketCreate a ticket
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;
- Read upRead up
- Create a ticketCreate a ticket
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 {
- Read upRead up
- Create a ticketCreate a ticket
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,
- Read upRead up
- Create a ticketCreate a ticket
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 ||
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Wontfix
return true;
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Wontfix
return false;
- Create a ticketCreate a ticket
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
- Create a ticketCreate a ticket
Function __eliminateHoles
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Wontfix
const __eliminateHoles = (
points: ReadonlyVec[],
pids: number[],
holeIndices: number[],
outerNode: Vertex
- Read upRead up
- Create a ticketCreate a ticket
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>
) => {
- Read upRead up
- Create a ticketCreate a ticket
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"