Showing 383 of 2,131 total issues
File tensor.ts
has 676 lines of code (exceeds 250 allowed). Consider refactoring. Open
// SPDX-License-Identifier: Apache-2.0
import type { Maybe, NumericArray } from "@thi.ng/api";
import { swizzle } from "@thi.ng/arrays/swizzle";
import { isNumber } from "@thi.ng/checks/is-number";
import { equiv, equivArrayLike } from "@thi.ng/equiv";
- Create a ticketCreate a ticket
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,
- Read upRead up
- Create a ticketCreate a ticket
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
) => {
- Read upRead up
- Create a ticketCreate a ticket
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 parseIPv6Address
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
export const parseIPv6Address = (addr: string) => {
if (addr == "::") return [0, 0, 0, 0, 0, 0, 0, 0];
if (addr == "::1") return [0, 0, 0, 0, 0, 0, 0, 1];
const n = addr.length - 1;
if (n > 38) invalidIPv6(addr);
- Read upRead up
- Create a ticketCreate a ticket
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 defOpTT
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
export const defOpTT = <T = number>(fn: FnU2<T>): TensorOpTT<T> => {
type $OP = (out: ITensor<T>, a: ITensor<T>, b: ITensor<T>) => ITensor<T>;
const f1: $OP = (out, a, b) => {
!out && (out = a);
const {
- Read upRead up
- Create a ticketCreate a ticket
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 defOpTTT
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
export const defOpTTT = <T = number>(fn: FnU3<T>): TensorOpTTT<T> => {
type $OP = (
out: ITensor<T>,
a: ITensor<T>,
b: ITensor<T>,
- Read upRead up
- Create a ticketCreate a ticket
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 defOpTN
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
export const defOpTN = <T = number>(fn: FnU2<T>) => {
type $OP = (out: ITensor<T> | null, a: ITensor<T>, n: T) => ITensor<T>;
const f1: $OP = (out, a, n) => {
!out && (out = a);
const {
- Read upRead up
- Create a ticketCreate a ticket
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 defOpTNN
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
export const defOpTNN = <T = number>(fn: FnU3<T>) => {
type $OP = (out: ITensor<T>, a: ITensor<T>, n: T, m: T) => ITensor<T>;
const f1: $OP = (out, a, n, m) => {
!out && (out = a);
const {
- Read upRead up
- Create a ticketCreate a ticket
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 defOpT
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
export const defOpT = <T = number>(fn: Fn<T, T>) => {
type $OP = (out: ITensor<T> | null, a: ITensor<T>) => ITensor<T>;
const f1: $OP = (out, a) => {
!out && (out = a);
const {
- Read upRead up
- Create a ticketCreate a ticket
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;
- Read upRead up
- Create a ticketCreate a ticket
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 defOpRTT
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
export const defOpRTT = <A = number, B = A>(
rfn: (
acc: B,
adata: TensorData<A>,
bdata: TensorData<A>,
- Read upRead up
- Create a ticketCreate a ticket
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],
- Read upRead up
- Create a ticketCreate a ticket
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 defOpRT
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
export const defOpRT = <A = number, B = A>(
rfn: (acc: B, data: TensorData<A>, i: number) => B,
init: Fn0<B>
) => {
const f1: TensorOpRT<A, B> = (a) => {
- Read upRead up
- Create a ticketCreate a ticket
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 defOpN
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
export const defOpN = <A = number, B = A>(fn: Fn<A, B>) => {
type $OP = (out: ITensor<B>, n: A) => ITensor<B>;
const f1: $OP = (out, a) => {
const {
data,
- Read upRead up
- Create a ticketCreate a ticket
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) {
- Read upRead up
- Create a ticketCreate a ticket
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];
- Read upRead up
- Create a ticketCreate a ticket
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 update
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
update(curr: T) {
const {
prev,
flow,
windowSize,
- Read upRead up
- Create a ticketCreate a ticket
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;
- Read upRead up
- Create a ticketCreate a ticket
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 {
- Read upRead up
- Create a ticketCreate a ticket
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,
- Read upRead up
- Create a ticketCreate a ticket
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"