thi-ng/umbrella

View on GitHub

Showing 378 of 1,891 total issues

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

export const swapLane02: FnN = (x) =>
    ((x & 0xff00) << 16) | ((x >>> 16) & 0xff00) | (x & 0x00ff00ff);
Severity: Minor
Found in packages/binary/src/swizzle.ts and 1 other location - About 50 mins to fix
packages/pixel/src/internal/utils.ts on lines 138..139

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 52.

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 __swapLane13: FnN = (x) =>
    ((x & 0xff) << 16) | ((x >> 16) & 0xff) | (x & 0xff00ff00);
Severity: Minor
Found in packages/pixel/src/internal/utils.ts and 1 other location - About 50 mins to fix
packages/binary/src/swizzle.ts on lines 228..229

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 52.

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 __complexComponent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const __complexComponent = (tree: any[]): CompiledComponent => ({
    async mount(parent: ParentNode, index: NumOrElement = -1) {
        this.subs = [];
        const attribs = { ...tree[1] };
        __walk((x, path) => {
Severity: Minor
Found in packages/rdom/src/compile.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 partitionSync has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function partitionSync<T>(...args: any[]): any {
    const iter = __iter(partitionSync, args, iterator);
    if (iter) return iter;

    const {
Severity: Minor
Found in packages/transducers/src/partition-sync.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 blit2d has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    dest: any[],
    dpos: ArrayLike<number>,
    dsize: ArrayLike<number>,
    src: ArrayLike<any>,
    ssize: ArrayLike<number>,
Severity: Minor
Found in packages/arrays/src/blit.ts - About 45 mins to fix

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

export function* permutations(...src: any[]): IterableIterator<any[]> {
    const n = src.length - 1;
    if (n < 0) {
        return;
    }
Severity: Minor
Found in packages/transducers/src/permutations.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 withSDFModifiers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const withSDFModifiers = (fn: SDFn, mods: Partial<SDFModifiers>) => {
    const {
        abs: $abs,
        flip: $flip,
        offset: $offset,
Severity: Minor
Found in packages/geom-sdf/src/ops.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 sample2d has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const sample2d = (
    sdf: SDFn,
    { pos: [px, py], size: [width, height] }: AABBLike,
    [resX, resY]: ReadonlyVec,
    domain?: Fn<ReadonlyVec, Vec>,
Severity: Minor
Found in packages/geom-sdf/src/sample.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 normRange3d has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    nx: number,
    ny: number,
    nz: number,
    includeLastX = true,
    includeLastY = true,
Severity: Minor
Found in packages/transducers/src/norm-range.ts - About 45 mins to fix

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

const __kernelLookup1d = (
    src: ArrayLike<number>,
    x: number,
    width: number,
    wrap: boolean,
Severity: Minor
Found in packages/transducers/src/convolve.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 topoSort has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const topoSort = <T>(
    nodes: IObjectOf<T>,
    deps: Fn2<T, string, Nullable<string[]>>
) => {
    const cycles: IObjectOf<boolean> = {};
Severity: Minor
Found in packages/arrays/src/topo-sort.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 $reduce has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    $reduce<T>(
        rfn: ReductionFn<number, T>,
        acc: T | Reduced<T>
    ): T | Reduced<T> {
        const step = this.step;
Severity: Minor
Found in packages/transducers/src/range.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

Avoid deeply nested control flow statements.
Open

                        if (
                            neighborhood.includesPosition(
                                keyFn(items[entries[i]])
                            )
                        )
Severity: Major
Found in packages/geom-accel/src/hash-grid.ts - About 45 mins to fix

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

export const orderedDither = (
    img: IntBuffer,
    size: BayerSize | BayerMatrix,
    numColors: number | number[]
) => {
Severity: Minor
Found in packages/pixel-dither/src/ordered.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

Avoid deeply nested control flow statements.
Open

                if (last) curr.push(p);
Severity: Major
Found in packages/geom-trace-bitmap/src/trace.ts - About 45 mins to fix

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

    toHiccup() {
        const attribs = this.attribs;
        const acc: any[] = ["g", { fill: "none", ...attribs }];
        if (attribs && attribs.res) {
            const res = attribs.res - 1;
Severity: Minor
Found in packages/geom/src/api/bpatch.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 __simpleDiff has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const __simpleDiff = <T>(
    state: ArrayDiff<T>,
    src: ArrayLike<T>,
    key: "adds" | "dels",
    logDir: number,
Severity: Minor
Found in packages/diff/src/array.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 buttonRaw has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const buttonRaw = (
    gui: IMGUI,
    id: string,
    shape: IShape,
    hash: Hash,
Severity: Minor
Found in packages/imgui/src/components/button.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 fitAllIntoBounds2 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const fitAllIntoBounds2 = (shapes: IShape2[], dest: Rect) => {
    const sbraw = __collBounds(shapes, bounds);
    if (!sbraw) return;
    const src = new Rect(...sbraw);
    const sx = safeDiv(dest.size[0], src.size[0]);
Severity: Minor
Found in packages/geom/src/fit-into-bounds.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 sort has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    sort() {
        const sorted: T[] = [];
        const g = this.copy();
        let queue = new ArraySet(g.leaves());
        while (true) {
Severity: Minor
Found in packages/dgraph/src/index.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

Severity
Category
Status
Source
Language