thi-ng/umbrella

View on GitHub
packages/geom-resample/src/sampler.ts

Summary

Maintainability
A
2 hrs
Test Coverage

Function closestT has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    closestT(p: ReadonlyVec) {
        const { index, points } = this;
        const tmp: Vec = [];
        const closest: Vec = [];
        let minD = Infinity;
Severity: Minor
Found in packages/geom-resample/src/sampler.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

Function pointAt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    pointAt(t: number): Maybe<Vec> {
        const pts = this.points;
        const n = pts.length - 1;
        if (n < 0) {
            return;
Severity: Minor
Found in packages/geom-resample/src/sampler.ts - About 35 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 sampleUniform has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    sampleUniform(dist: number, includeLast = false, result: Vec[] = []) {
        const { index, points } = this;
        const total = this.totalLength();
        const delta = dist / total;
        const n = index.length;
Severity: Minor
Found in packages/geom-resample/src/sampler.ts - About 35 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 extractRange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    extractRange(start: number, end: number): Maybe<Vec[]> {
        if (start > end) {
            const t = start;
            start = end;
            end = t;
Severity: Minor
Found in packages/geom-resample/src/sampler.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 indexAt has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    indexAt(t: number) {
        const pts = this.points;
        const n = pts.length - 1;
        if (n < 0) {
            return;
Severity: Minor
Found in packages/geom-resample/src/sampler.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