thi-ng/umbrella

View on GitHub

Showing 361 of 1,767 total issues

Function serialize has a Cognitive Complexity of 104 (exceeds 5 allowed). Consider refactoring.
Open

export const serialize = (src: any, opts: Partial<EncodeOpts> = {}) => {
    const { initial = 256, resolve } = opts;
    let buf = new Uint8Array(initial);
    let view = new DataView(buf.buffer);
    let pos = 0;
Severity: Minor
Found in packages/msgpack/src/serialize.ts - About 2 days 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 stratifiedGrid3 has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
Open

export function* stratifiedGrid3(opts: StratifiedGridOpts) {
    let { rnd = SYSTEM, separation: sep = Math.SQRT1_2 } = opts;
    sep *= sep;
    const scale =
        opts.scale !== undefined
Severity: Minor
Found in packages/poisson/src/stratified.ts - About 1 day 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 process has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

    protected async process() {
        if (!this.isBusy) {
            this.isBusy = true;
            const { buf, txbuf, reads, writes } = this;
            let doProcess: any = true;
Severity: Minor
Found in packages/csp/src/channel.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 asGeometry has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

export const asGeometry = (
    src: Iterable<DrawCommand>,
    opts: Partial<AsGeometryOpts> = {}
) => {
    opts = {
Severity: Minor
Found in packages/geom-axidraw/src/as-geometry.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 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 _normalizeTree has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

const _normalizeTree = (
    tree: any,
    opts: Partial<HDOMOpts>,
    ctx: any,
    path: number[],
Severity: Minor
Found in packages/hdom/src/normalize.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 C11 has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

export const C11 = (opts: Partial<C11Opts> = {}) => {
    const { typePrefix = "" } = opts;
    const INDENT = "    ";
    const SCOPES: [RegExp, RegExp] = [/\{$/, /^\}[ A-Za-z0-9_]*[;,]?$/];

Severity: Minor
Found in packages/wasm-api-bindgen/src/c11.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 ZIG has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

export const ZIG = (opts: Partial<ZigOpts> = {}) => {
    const INDENT = "    ";
    const SCOPES: [RegExp, RegExp] = [/\{$/, /(?<!\{.*)\}\)?[;,]?$/];

    const gen: ICodeGen = {
Severity: Minor
Found in packages/wasm-api-bindgen/src/zig.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 stratifiedGrid2 has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

export function* stratifiedGrid2(opts: StratifiedGridOpts) {
    let { rnd = SYSTEM, separation: sep = Math.SQRT1_2 } = opts;
    sep *= sep;
    const scale =
        opts.scale !== undefined
Severity: Minor
Found in packages/poisson/src/stratified.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

transformScope has 34 functions (exceeds 20 allowed). Consider refactoring.
Open

    {
        [DEFAULT]: (scope: ParseScope<string>, ctx: TransformCtx) => {
            throw new Error(
                `unknown ID: ${scope.id}, ctx: ${JSON.stringify(ctx)}`
            );
Severity: Minor
Found in packages/hiccup-markdown/src/parse.ts - About 4 hrs to fix

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

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

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

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

File easing.ts has 322 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import type { FnBody1 } from "@thi.ng/shader-ast";
import { F } from "@thi.ng/shader-ast/api/types";
import { ifThen, ternary } from "@thi.ng/shader-ast/ast/controlflow";
import { defn, ret } from "@thi.ng/shader-ast/ast/function";
import {
Severity: Minor
Found in packages/shader-ast-stdlib/src/math/easing.ts - About 3 hrs to fix
Severity
Category
Status
Source
Language