thi-ng/umbrella

View on GitHub

Showing 765 of 1,901 total issues

Function rule has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        rule: ($, lang, opts, flags) => {
            const [id, body, xf] = $.children!;
            opts.debug && console.log(`rule: ${id.result}`, xf);
            const acc: Parser<string>[] = [];
            for (let b of body.children!) {
Severity: Minor
Found in packages/parse/src/grammar.ts - About 1 hr 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 kmeans has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export const kmeans = <T extends ReadonlyVec>(
    k: number,
    samples: T[],
    opts?: Partial<KMeansOpts>
) => {
Severity: Minor
Found in packages/k-means/src/kmeans.ts - About 1 hr 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 __themes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function* __themes<T extends Theme>(
    fn: (id: number) => T,
    preds: ThemePredicate[] | number[]
) {
    if (preds.length && typeof preds[0] === "function") {
Severity: Minor
Found in packages/color-palettes/src/theme.ts - About 1 hr 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 13 (exceeds 5 allowed). Consider refactoring.
Open

    setAttrib(el: HDOMNode, id: string, val: any, attribs?: any) {
        if (id.startsWith("__")) return;
        const isListener = id.indexOf("on") === 0;
        if (!isListener && typeof val === "function") {
            val = val(attribs);
Severity: Minor
Found in packages/hdom-mock/src/index.ts - About 1 hr 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 path has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        path: ($: Path, p, out) => {
            let minD = Infinity;
            const $closestPSegment = (segments: PathSegment[]) => {
                for (let s of segments) {
                    if (!s.geo) continue;
Severity: Minor
Found in packages/geom/src/closest-point.ts - About 1 hr 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 entries has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    *entries(key?: K, max = false): IterableIterator<Pair<K, V>> {
        if (key === undefined) {
            yield* this;
            return;
        }
Severity: Minor
Found in packages/associative/src/sorted-map.ts - About 1 hr 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 exposeGlobal has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export const exposeGlobal = (id: string, value: any, always = false) => {
    const glob: any =
        typeof global !== "undefined"
            ? global
            : typeof window !== "undefined"
Severity: Minor
Found in packages/expose/src/index.ts - About 1 hr 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 convexity has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Confirmed

export const convexity = (pts: ReadonlyVec[], eps = EPS) => {
    let n = pts.length;
    if (n < 3) {
        return n < 2 ? Convexity.ILLEGAL : Convexity.COLINEAR;
    }
Severity: Minor
Found in packages/geom-poly-utils/src/convexity.ts - About 1 hr 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 traverse has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export const traverse = (
    subs: ISubscribable<any>[],
    opts?: Partial<DotOpts>,
    state?: TraversalState
) => {
Severity: Minor
Found in packages/rstream-dot/src/index.ts - About 1 hr 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 __generateFields has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const __generateFields = (
    gen: ICodeGen,
    parent: Struct | Union,
    coll: TypeColl,
    opts: CodeGenOpts,
Severity: Minor
Found in packages/wasm-api-bindgen/src/c11.ts - About 1 hr 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 computeCell has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    computeCell(
        { rule, kernel, weights, fn }: CAConfig1D,
        x: number,
        val: number
    ) {
Severity: Minor
Found in packages/cellular/src/1d.ts - About 1 hr 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 toPath has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export const toPath = (path: Path): readonly NumOrString[] => {
    if (isArray(path)) {
        if (!path.every((x) => isString(x) || isNumber(x))) __illegal(path);
        return <any[]>path;
    } else {
Severity: Minor
Found in packages/paths/src/path.ts - About 1 hr 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 bitWriter has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export const bitWriter = (capacity = 16) => {
    let buf = new Uint8Array(capacity);
    let pos = 0;
    let bit = 8;

Severity: Minor
Found in packages/bitstream/src/simple.ts - About 1 hr 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 authorLink has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export const authorLink = (author: string | User) => {
    if (isString(author)) {
        const [name, a, b] = author.split(/\s*[<(]/);
        const href = b ? (b[b.length - 1] == ")" ? b : a) : a ? a : "";
        return href.length && href[href.length - 1] === ")"
Severity: Minor
Found in packages/transclude/src/tpl/pkg.ts - About 1 hr 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 5 locations. Consider refactoring.
Open

export function multiplex<T, A, B>(
    a: AsyncMultiplexTxLike<T, A>,
    b: AsyncMultiplexTxLike<T, B>
): AsyncTransducer<T, [A, B]>;
Severity: Major
Found in packages/transducers-async/src/multiplex.ts and 4 other locations - About 1 hr to fix
packages/compose/src/juxt.ts on lines 4..4
packages/compose/src/juxt.ts on lines 99..99
packages/transducers/src/juxtr.ts on lines 24..27
packages/transducers/src/multiplex.ts on lines 69..72

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

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

export function juxtR<A, B1, B2>(
    r1: Reducer<A, B1>,
    r2: Reducer<A, B2>
): Reducer<A, [B1, B2]>;
Severity: Major
Found in packages/transducers/src/juxtr.ts and 4 other locations - About 1 hr to fix
packages/compose/src/juxt.ts on lines 4..4
packages/compose/src/juxt.ts on lines 99..99
packages/transducers-async/src/multiplex.ts on lines 9..12
packages/transducers/src/multiplex.ts on lines 69..72

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

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 lshift<A extends UVec, B extends A>(l: Term<A>, r: Term<B> | UintTerm): Term<A>;
Severity: Major
Found in packages/shader-ast/src/ast/ops.ts and 1 other location - About 1 hr to fix
packages/shader-ast/src/ast/ops.ts on lines 438..438

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

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 ensureAsyncTransducer = <A, B>(x: AsyncTxLike<A, B>) =>
    implementsFunction(x, "xformAsync")
        ? x.xformAsync()
        : <AsyncTransducer<A, B>>x;
Severity: Major
Found in packages/transducers-async/src/ensure.ts and 1 other location - About 1 hr to fix
packages/transducers/src/ensure.ts on lines 4..5

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

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

    (async () => {
        for await (let x of src) {
            await chan.write(x);
            if (!chan.writable()) break;
        }
Severity: Major
Found in packages/csp/src/ops.ts and 1 other location - About 1 hr to fix
packages/csp/src/ops.ts on lines 156..162

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

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 rshift<A extends UVec, B extends A>(l: Term<A>, r: Term<B> | UintTerm): Term<A>;
Severity: Major
Found in packages/shader-ast/src/ast/ops.ts and 1 other location - About 1 hr to fix
packages/shader-ast/src/ast/ops.ts on lines 421..421

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

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

Severity
Category
Status
Source
Language