thi-ng/umbrella

View on GitHub

Showing 374 of 1,877 total issues

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

export const MAXIMA4_DIAG: KernelFnSpec = {
    fn: (src) => {
        const {
            data: pix,
            stride: [stride, rowStride],
Severity: Major
Found in packages/pixel-convolve/src/convolve.ts and 1 other location - About 1 day to fix
packages/pixel-convolve/src/convolve.ts on lines 472..493

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

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 MAXIMA4_CROSS: KernelFnSpec = {
    fn: (src) => {
        const {
            data: pix,
            stride: [stride, rowStride],
Severity: Major
Found in packages/pixel-convolve/src/convolve.ts and 1 other location - About 1 day to fix
packages/pixel-convolve/src/convolve.ts on lines 512..533

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

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 class SparseSet8
    extends ASparseSet<Uint8Array>
    implements IEquivSet<number>
{
    constructor(dense: Uint8Array, sparse: Uint8Array);
Severity: Major
Found in packages/sparse-set/src/index.ts and 1 other location - About 1 day to fix
packages/sparse-set/src/index.ts on lines 190..219

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

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 class SparseSet16
    extends ASparseSet<Uint16Array>
    implements IEquivSet<number>
{
    constructor(dense: Uint16Array, sparse: Uint16Array);
Severity: Major
Found in packages/sparse-set/src/index.ts and 1 other location - About 1 day to fix
packages/sparse-set/src/index.ts on lines 159..188

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

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

File convolve.ts has 398 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import type { Fn, FnN3, NumericArray } from "@thi.ng/api";
import { isFunction } from "@thi.ng/checks/is-function";
import { assert } from "@thi.ng/errors/assert";
import { clamp } from "@thi.ng/math/interval";
import { lanczos } from "@thi.ng/math/mix";
Severity: Minor
Found in packages/pixel-convolve/src/convolve.ts - About 5 hrs to fix

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

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 __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