thi-ng/umbrella

View on GitHub

Showing 771 of 1,902 total issues

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

export const hash13 = defn(F, "hash13", [V3], (p) => {
    let x: Vec3Sym;
    return [
        (x = sym(fract(mul($(p, "xyx"), 0.1031)))),
        addSelf(x, dot(x, add($(x, "yzx"), 19.19))),
Severity: Major
Found in packages/shader-ast-stdlib/src/noise/hash.ts and 1 other location - About 4 hrs to fix
packages/shader-ast-stdlib/src/noise/hash.ts on lines 68..75

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

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

File c11.ts has 341 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { topoSort } from "@thi.ng/arrays/topo-sort";
import { isString } from "@thi.ng/checks/is-string";
import { unsupported } from "@thi.ng/errors/unsupported";
import { capitalize } from "@thi.ng/strings/case";
import type {
Severity: Minor
Found in packages/wasm-api-bindgen/src/c11.ts - About 4 hrs to fix

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

export const hash41 = defn(V4, "hash41", [F], (p) => {
    let x: Vec4Sym;
    return [
        (x = sym(fract(mul(p, H4)))),
        addSelf(x, dot(x, add($(x, "wzxy"), 19.19))),
Severity: Major
Found in packages/shader-ast-stdlib/src/noise/hash.ts and 3 other locations - About 4 hrs to fix
packages/shader-ast-stdlib/src/noise/hash.ts on lines 132..139
packages/shader-ast-stdlib/src/noise/hash.ts on lines 148..155
packages/shader-ast-stdlib/src/noise/hash.ts on lines 180..187

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

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 4 locations. Consider refactoring.
Open

export const hash33 = defn(V3, "hash33", [V3], (p) => {
    let x: Vec3Sym;
    return [
        (x = sym(fract(mul(p, H)))),
        addSelf(x, dot(x, add($(x, "yzx"), 19.19))),
Severity: Major
Found in packages/shader-ast-stdlib/src/noise/hash.ts and 3 other locations - About 4 hrs to fix
packages/shader-ast-stdlib/src/noise/hash.ts on lines 132..139
packages/shader-ast-stdlib/src/noise/hash.ts on lines 148..155
packages/shader-ast-stdlib/src/noise/hash.ts on lines 196..203

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

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 4 locations. Consider refactoring.
Open

export const hash23 = defn(V2, "hash23", [V3], (p) => {
    let x: Vec3Sym;
    return [
        (x = sym(fract(mul(p, H)))),
        addSelf(x, dot(x, add($(x, "yzx"), 19.19))),
Severity: Major
Found in packages/shader-ast-stdlib/src/noise/hash.ts and 3 other locations - About 4 hrs to fix
packages/shader-ast-stdlib/src/noise/hash.ts on lines 148..155
packages/shader-ast-stdlib/src/noise/hash.ts on lines 180..187
packages/shader-ast-stdlib/src/noise/hash.ts on lines 196..203

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

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 4 locations. Consider refactoring.
Open

export const hash31 = defn(V3, "hash31", [F], (p) => {
    let x: Vec3Sym;
    return [
        (x = sym(fract(mul(p, H)))),
        addSelf(x, dot(x, add($(x, "yzx"), 19.19))),
Severity: Major
Found in packages/shader-ast-stdlib/src/noise/hash.ts and 3 other locations - About 4 hrs to fix
packages/shader-ast-stdlib/src/noise/hash.ts on lines 132..139
packages/shader-ast-stdlib/src/noise/hash.ts on lines 180..187
packages/shader-ast-stdlib/src/noise/hash.ts on lines 196..203

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

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

        el: ({ children }, opts, acc) => {
            const [name, { children: $attribs }, body] = children!;
            if (opts.ignoreElements?.includes(name.result)) return;
            const attribs: any = {};
            const el: Element = [name.result, attribs];
Severity: Minor
Found in packages/hiccup-html-parse/src/index.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

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

        switch (classifier) {
            case "strPtr":
                type = `*${type}`;
                break;
            case "strPtrFixed":
Severity: Major
Found in packages/wasm-api-bindgen/src/zig.ts and 1 other location - About 4 hrs to fix
packages/wasm-api-bindgen/src/zig.ts on lines 237..253

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

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

        switch (classifier) {
            case "opaquePtr":
                type = `*${type}`;
                break;
            case "opaquePtrFixed":
Severity: Major
Found in packages/wasm-api-bindgen/src/zig.ts and 1 other location - About 4 hrs to fix
packages/wasm-api-bindgen/src/zig.ts on lines 218..234

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

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 function minCompare(...args: any[]): any {
    const res = $$reduce(minCompare, args);
    if (res !== undefined) {
        return res;
    }
Severity: Major
Found in packages/transducers/src/min-compare.ts and 1 other location - About 3 hrs to fix
packages/transducers/src/max-compare.ts on lines 13..21

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

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 function maxCompare(...args: any[]): any {
    const res = $$reduce(maxCompare, args);
    if (res !== undefined) {
        return res;
    }
Severity: Major
Found in packages/transducers/src/max-compare.ts and 1 other location - About 3 hrs to fix
packages/transducers/src/min-compare.ts on lines 13..21

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

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

export const outputProc: Processor = async (spec, input, ctx) => {
    const opts = <OutputSpec>spec;
    const outDir = resolve(ctx.opts.outDir || ".");
    let output = input.clone();
    if (opts.blurhash) {
Severity: Minor
Found in packages/imago/src/ops/output.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

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

export function multiplexObj(...args: any[]): any {
    const iter = __iter(multiplexObj, args);
    if (iter) {
        return iter;
    }
Severity: Major
Found in packages/transducers-async/src/multiplex-obj.ts and 1 other location - About 3 hrs to fix
packages/transducers/src/multiplex-obj.ts on lines 45..56

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

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

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

export function multiplexObj(...args: any[]): any {
    const iter = __iter(multiplexObj, args);
    if (iter) {
        return iter;
    }
Severity: Major
Found in packages/transducers/src/multiplex-obj.ts and 1 other location - About 3 hrs to fix
packages/transducers-async/src/multiplex-obj.ts on lines 25..36

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

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

DEFAULT_TAG_TRANSFORMS has 31 functions (exceeds 20 allowed). Consider refactoring.
Open

export const DEFAULT_TAG_TRANSFORMS: TagTransforms = {
    bold: (_, body) => ["strong", {}, ...body],
    blockquote: (_, body, meta) => ["blockquote", withMeta({}, meta), ...body],
    br: () => ["br", {}],
    code: (_, body) => ["code", {}, body],
Severity: Minor
Found in packages/hiccup-markdown/src/parse.ts - About 3 hrs to fix

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

export function comp<A, B, C, D, E, F>(
    a: AsyncTransducer<A, B>,
    b: AsyncTransducer<B, C>,
    c: AsyncTransducer<C, D>,
    d: AsyncTransducer<D, E>,
Severity: Major
Found in packages/transducers-async/src/comp.ts and 1 other location - About 3 hrs to fix
packages/transducers/src/comp.ts on lines 28..34

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

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 function comp<A, B, C, D, E, F>(
    a: TxLike<A, B>,
    b: TxLike<B, C>,
    c: TxLike<C, D>,
    d: TxLike<D, E>,
Severity: Major
Found in packages/transducers/src/comp.ts and 1 other location - About 3 hrs to fix
packages/transducers-async/src/comp.ts on lines 21..27

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

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

const readFloat = (src: string, index: number) => {
    index = skipWS(src, index);
    let signOk = true;
    let dotOk = true;
    let expOk = false;
Severity: Minor
Found in packages/geom/src/path-from-svg.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 dropdown has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

export const dropdown = (
    gui: IMGUI,
    layout: IGridLayout<any> | LayoutBox,
    id: string,
    sel: number,
Severity: Minor
Found in packages/imgui/src/components/dropdown.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 __points has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

function* __points(
    pts: ReadonlyVec[],
    attribs?: Attribs,
    opts?: Partial<AsAxiDrawOpts>
): IterableIterator<DrawCommand> {
Severity: Minor
Found in packages/geom-axidraw/src/as-axidraw.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

Severity
Category
Status
Source
Language