thi-ng/umbrella

View on GitHub

Showing 378 of 1,891 total issues

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

export const grahamScan2 = (pts: ReadonlyVec[], eps = EPS) => {
    const num = pts.length;
    if (num <= 3) return pts.slice();
    let h = 1;
    let i;
Severity: Minor
Found in packages/geom-hull/src/graham-scan.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 qualifiedID has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const qualifiedID = (prefixes: Prefixes, id: string) => {
    if (id[0] === "<" && id[id.length - 1] === ">") {
        return id.substring(1, id.length - 1);
    }
    if (id.indexOf(":") !== -1) {
Severity: Minor
Found in packages/egf/src/prefix.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 compareByKeys3 has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    a: string | Fn<any, any>,
    b: string | Fn<any, any>,
    c: string | Fn<any, any>,
    cmpA: Comparator<any> = compare,
    cmpB: Comparator<any> = compare,
Severity: Minor
Found in packages/compare/src/keys.ts - About 45 mins to fix

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

    childForPoint(p: ReadonlyVec): Maybe<NodeInfo<T>> {
        if (this.enabled) {
            const children = this.children;
            for (let i = children.length; i-- > 0; ) {
                const n = children[i].childForPoint(p);
Severity: Minor
Found in packages/scenegraph/src/anode.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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        let x: IteratorResult<Pair<K, V>>, y: IteratorResult<Pair<K, V>>;
Severity: Minor
Found in packages/sorted-map/src/sorted-map.ts and 1 other location - About 45 mins to fix
packages/sorted-map/src/sorted-set.ts on lines 90..90

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    const c = Math.exp(
        -Math.log((Math.abs(end - start) + rate) / rate) / steps
    );
Severity: Minor
Found in packages/transducers/src/curve.ts and 1 other location - About 40 mins to fix
packages/dsp/src/curve.ts on lines 52..52

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 49.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const contributors = (people: (string | User)[], eol = "\n") =>
    list(people.map(author), eol);
Severity: Minor
Found in packages/transclude/src/tpl/pkg.ts and 1 other location - About 40 mins to fix
packages/transclude/src/tpl/pkg.ts on lines 170..171

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 49.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const radio = ({
    gui,
    layout,
    id,
    horizontal,
Severity: Minor
Found in packages/imgui/src/components/radio.ts and 1 other location - About 40 mins to fix
packages/text-format/src/html.ts on lines 14..44

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 49.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    const c = Math.exp(-Math.log((Math.abs(end - start) + rate) / rate) / num);
Severity: Minor
Found in packages/dsp/src/curve.ts and 1 other location - About 40 mins to fix
packages/transducers/src/curve.ts on lines 49..51

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 49.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const contributorLinks = (people: (string | User)[], eol = "\n") =>
    list(people.map(authorLink), eol);
Severity: Minor
Found in packages/transclude/src/tpl/pkg.ts and 1 other location - About 40 mins to fix
packages/transclude/src/tpl/pkg.ts on lines 161..162

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 49.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const formatHtml = ({
    colors,
    attrib,
    delim,
    fg,
Severity: Minor
Found in packages/text-format/src/html.ts and 1 other location - About 40 mins to fix
packages/imgui/src/components/radio.ts on lines 32..63

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 49.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    nth(n: number, notFound?: T) {
        const cell = this.nthCell(n);
        return cell ? cell.value : notFound;
    }
Severity: Minor
Found in packages/dcons/src/ring.ts and 1 other location - About 40 mins to fix
packages/dcons/src/dcons.ts on lines 162..165

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 48.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function quickSort has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    arr: any,
    _cmp: Comparator<any> = compare,
    _swap: Fn3<any, number, number, void> = swap,
    start = 0,
    end = arr.length - 1
Severity: Minor
Found in packages/arrays/src/quicksort.ts - About 35 mins to fix

Function floydRivest has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    buf: any[] | TypedArray,
    k = 1,
    cmp: Comparator<any> = compare,
    left = 0,
    right = buf.length - 1
Severity: Minor
Found in packages/arrays/src/floyd-rivest.ts - About 35 mins to fix

Function clipped has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    src: Iterable<number[]>,
    left: number,
    top: number,
    right: number,
    bottom: number
Severity: Minor
Found in packages/grid-iterators/src/clipping.ts - About 35 mins to fix

Function floodFill has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    pred: Predicate2<number>,
    x: number,
    y: number,
    width: number,
    height: number
Severity: Minor
Found in packages/grid-iterators/src/flood-fill.ts - About 35 mins to fix

Function withIndentation has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    lines: string[],
    indent: string,
    scopeStart: RegExp,
    scopeEnd: RegExp,
    level = 0
Severity: Minor
Found in packages/wasm-api-bindgen/src/internal/utils.ts - About 35 mins to fix

Function isolines has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    src: ReadonlyVec,
    w: number,
    h: number,
    iso: number,
    scale: ReadonlyVec | number = 1
Severity: Minor
Found in packages/geom-isoline/src/index.ts - About 35 mins to fix

Function createTree has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    createTree(opts, parent, tree, child?, init?) {
Severity: Minor
Found in packages/hdom/src/default.ts - About 35 mins to fix
Severity
Category
Status
Source
Language