thi-ng/umbrella

View on GitHub

Showing 366 of 1,904 total issues

Function clipPolylinePoly has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

export const clipPolylinePoly = (pts: ReadonlyVec[], poly: ReadonlyVec[]) => {
    let res: ReadonlyVec[][] = [];
    if (pts.length < 2) return res;
    let isAInside = pointInPolygon2(pts[0], poly);
    for (let i = 0, n = pts.length - 1; i < n; i++) {
Severity: Minor
Found in packages/geom-clip-line/src/clip-poly.ts - About 2 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 encodeBytes has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

export const encodeBytes = (src: Uint8Array) => {
    const freq = new Uint32Array(FREQ).fill(1);
    const out = new BitOutputStream(Math.max(src.length >> 1, 1));
    const len = src.length;
    let total = FREQ;
Severity: Minor
Found in packages/range-coder/src/index.ts - About 2 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 plotLineChart has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

export const plotLineChart = (
    canvas: Canvas,
    x: number,
    y: number,
    height: number,
Severity: Minor
Found in packages/text-canvas/src/plot.ts - About 2 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 __extract has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

const __extract = (pts: ReadonlyVec[], maxD: number, order: number) => {
    if (pts.length < 2) return { segments: [], points: pts };
    const $ = order ? (p: ReadonlyVec) => [p[1], p[0]] : (p: ReadonlyVec) => p;
    pts = pts.sort(comparator2(order, order ^ 1));
    const segments: VecPair[] = [];
Severity: Minor
Found in packages/geom-trace-bitmap/src/extract.ts - About 2 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 _sizeOf has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

const _sizeOf = (
    spec: Field[],
    union: boolean,
    doAlign: boolean,
    bitOffset: number,
Severity: Minor
Found in packages/unionstruct/src/index.ts - About 2 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 fromRAF has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

export const fromRAF = (opts: Partial<FromRAFOpts> = {}) =>
    isNode()
        ? fromInterval(16, opts)
        : stream<number>((stream) => {
                let i = 0;
Severity: Minor
Found in packages/rstream/src/raf.ts - About 2 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 draw has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

export const draw = (
    specs: ModelSpec | ModelSpec[],
    opts: Partial<DrawFlags> = {}
) => {
    const _specs = isArray(specs) ? specs : [specs];
Severity: Minor
Found in packages/webgl/src/draw.ts - About 2 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 setAttrib has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

export const setAttrib = (el: Element, id: string, val: any, attribs?: any) => {
    implementsFunction(val, "deref") && (val = val.deref());
    if (id.startsWith("__")) return;
    const isListener = id[0] === "o" && id[1] === "n";
    if (isListener) {
Severity: Minor
Found in packages/hdom/src/dom.ts - About 2 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 splice has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    splice(at: ConsCell<T> | number, del = 0, insert?: Iterable<T>): DCons<T> {
        let cell: Maybe<ConsCell<T>>;
        if (typeof at === "number") {
            if (at < 0) {
                at += this._length;
Severity: Minor
Found in packages/dcons/src/dcons.ts - About 2 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 typedarray.ts has 268 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import type { Maybe } from "./null.js";

export type ArrayLikeIterable<T> = ArrayLike<T> & Iterable<T>;

export type NumericArray = number[] | TypedArray;
Severity: Minor
Found in packages/api/src/typedarray.ts - About 2 hrs to fix

Function doQuery has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    protected doQuery(
        p: K,
        r: number,
        max: number,
        acc: Heap<[number, NdQtNode<K, V>?]>,
Severity: Minor
Found in packages/geom-accel/src/nd-quadtree-map.ts - About 2 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 source has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

export const source = <T>(
    initial?: T,
    buffer: IReadWriteBuffer<Maybe<T>> | number = 1
) => {
    const queue = isNumber(buffer) ? fifo<Maybe<T>>(buffer) : buffer;
Severity: Minor
Found in packages/transducers-async/src/source.ts - About 2 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 formatPath has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

export const formatPath = (
    path: string,
    ctx: ImgProcCtx,
    spec: OutputSpec,
    buf: Buffer | TypedArray
Severity: Minor
Found in packages/imago/src/path.ts - About 2 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 __fieldType has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

const __fieldType = (
    f: Field,
    coll: TypeColl,
    opts: CodeGenOpts,
    prefix: string
Severity: Minor
Found in packages/wasm-api-bindgen/src/c11.ts - About 2 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 formatCond has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

const formatCond = (cond: any) => {
    if (isString(cond)) {
        return cond;
    }
    const acc = [];
Severity: Minor
Found in packages/hiccup-css/src/conditional.ts - About 2 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 createTree has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

export const createTree = <T>(
    opts: Partial<HDOMOpts>,
    impl: HDOMImplementation<T>,
    parent: T,
    tree: any,
Severity: Minor
Found in packages/hdom/src/dom.ts - About 2 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 target.ts has 266 lines of code (exceeds 250 allowed). Consider refactoring.
Confirmed

import type { Fn } from "@thi.ng/api";
import { isBoolean } from "@thi.ng/checks/is-boolean";
import { isNumber } from "@thi.ng/checks/is-number";
import { unsupported } from "@thi.ng/errors/unsupported";
import type {
Severity: Minor
Found in packages/shader-ast-js/src/target.ts - About 2 hrs to fix

File zig.ts has 265 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { isNumber } from "@thi.ng/checks";
import { isString } from "@thi.ng/checks/is-string";
import { illegalArgs } from "@thi.ng/errors/illegal-arguments";
import { capitalize } from "@thi.ng/strings/case";
import type {
Severity: Minor
Found in packages/wasm-api-bindgen/src/zig.ts - About 2 hrs to fix

File api.ts has 263 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import type { Fn, Predicate } from "@thi.ng/api";
import type {
    Attribs,
    FormAttribs,
    InputAttribs,
Severity: Minor
Found in packages/rdom-forms/src/api.ts - About 2 hrs to fix

Function sidechain has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

export async function* sidechain<T>(
    src: AsyncIterable<T>,
    side: AsyncIterable<any>,
    opts?: Partial<SidechainOpts>
) {
Severity: Minor
Found in packages/transducers-async/src/sidechain.ts - About 2 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