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 function movingMinimum(period: number, src?: Iterable<number>): any {
    return src
        ? iterator1(movingMinimum(period), src)
        : (rfn: Reducer<number, any>) => {
                const samples: number[] = [];
Severity: Major
Found in packages/transducers-stats/src/moving-minimum.ts and 1 other location - About 1 day to fix
packages/transducers-stats/src/moving-maximum.ts on lines 11..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 210.

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 movingMaximum(period: number, src?: Iterable<number>): any {
    return src
        ? iterator1(movingMaximum(period), src)
        : (rfn: Reducer<number, any>) => {
                const samples: number[] = [];
Severity: Major
Found in packages/transducers-stats/src/moving-maximum.ts and 1 other location - About 1 day to fix
packages/transducers-stats/src/moving-minimum.ts on lines 11..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 210.

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

export const traceLines = (
    opts: TraceOpts,
    order: Fn<GridIterOpts2D, Iterable<[number, number]>>,
    border: Predicate<[number, number]>,
    tx: PointTransform2D,
Severity: Minor
Found in packages/geom-trace-bitmap/src/trace.ts - About 6 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 deserialize has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

export const deserialize = (
    src: Uint8Array | ArrayBufferLike,
    start = 0,
    end = src.byteLength
) => {
Severity: Minor
Found in packages/msgpack/src/deserialize.ts - About 5 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 distanceTransform has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

export const distanceTransform = (
    {
        data: spix,
        size: [width, height],
        stride: [sx, sy],
Severity: Minor
Found in packages/distance-transform/src/transform.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

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;
Severity: Minor
Found in packages/geom-tessellate/src/earcut-complex.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

Function outputProc has a Cognitive Complexity of 29 (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 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

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

    for (let i = 0; i < n; i++) {
        const v = ring({
            ...opts,
            layout: nested,
            id: `${id}-${i}`,
Severity: Major
Found in packages/imgui/src/components/ring.ts and 3 other locations - About 3 hrs to fix
packages/imgui/src/components/dial.ts on lines 80..93
packages/imgui/src/components/sliderh.ts on lines 77..90
packages/imgui/src/components/sliderv.ts on lines 60..73

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

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

    for (let i = 0; i < n; i++) {
        const v = dial({
            ...opts,
            layout: nested,
            id: `${id}-${i}`,
Severity: Major
Found in packages/imgui/src/components/dial.ts and 3 other locations - About 3 hrs to fix
packages/imgui/src/components/ring.ts on lines 104..117
packages/imgui/src/components/sliderh.ts on lines 77..90
packages/imgui/src/components/sliderv.ts on lines 60..73

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

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

    for (let i = 0; i < n; i++) {
        const v = sliderV({
            ...opts,
            layout,
            id: `${id}-${i}`,
Severity: Major
Found in packages/imgui/src/components/sliderv.ts and 3 other locations - About 3 hrs to fix
packages/imgui/src/components/dial.ts on lines 80..93
packages/imgui/src/components/ring.ts on lines 104..117
packages/imgui/src/components/sliderh.ts on lines 77..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 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

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

    for (let i = 0; i < n; i++) {
        const v = sliderH({
            ...opts,
            layout: nested,
            id: `${id}-${i}`,
Severity: Major
Found in packages/imgui/src/components/sliderh.ts and 3 other locations - About 3 hrs to fix
packages/imgui/src/components/dial.ts on lines 80..93
packages/imgui/src/components/ring.ts on lines 104..117
packages/imgui/src/components/sliderv.ts on lines 60..73

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

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

const __sortLinked = (list: Nullable<Vertex>) => {
    let numMerges;
    let inSize = 1;

    do {
Severity: Minor
Found in packages/geom-tessellate/src/earcut-complex.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 circle has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

export const circle = (
    canvas: Canvas,
    cx: number,
    cy: number,
    r: number,
Severity: Minor
Found in packages/text-canvas/src/circle.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 fillPoly has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

export const fillPoly = <T extends any[] | TypedArray, P>(
    grid: IGrid2D<T, P>,
    pts: ArrayLike<number>[],
    val: P | Shader2D<P>
) => {
Severity: Minor
Found in packages/rasterize/src/poly.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 list has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

        list: (scope, ctx, acc) => {
            const children = scope.children![0].children!;
            const stack: any[][] = [
                [children[0].id === "ulitem" ? "ul" : "ol"],
            ];
Severity: Minor
Found in packages/hiccup-markdown/src/parse.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 __serialize has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

const __serialize = (tree: any, ctx: any, state: SerializeState): string =>
    tree == null
        ? ""
        : Array.isArray(tree)
        ? __serializeArray(tree, ctx, state)
Severity: Minor
Found in packages/hiccup-markdown/src/serialize.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 __drawInstanced has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

const __drawInstanced = (gl: WebGLRenderingContext, spec: ModelSpec) => {
    const isGL2 = isGL2Context(gl);
    const ext = !isGL2 ? gl.getExtension("ANGLE_instanced_arrays") : undefined;
    if (!(isGL2 || ext)) {
        error("instancing not supported");
Severity: Minor
Found in packages/webgl/src/draw.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 defuzz has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

export const defuzz = <I extends LVarSet<string>, O extends LVarSet<string>>(
    ins: I,
    outs: O,
    rules: Rule<I, O>[],
    vals: Partial<Record<keyof I, number>>,
Severity: Minor
Found in packages/fuzzy/src/defuzz.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