thi-ng/umbrella

View on GitHub

Showing 378 of 1,891 total issues

Function defn has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function defn(type: Type, id: Nullable<string>, _args: Arg<any>[], _body: (...args: Sym<any>[]) => ScopeBody): Func<any> {
    id = id || gensym();
    const args = _args.map(__defArg);
    const body = <Term<any>[]>(
        _body(...args.map((x) => sym(x.type, x.id, x.opts))).filter(
Severity: Minor
Found in packages/shader-ast/src/ast/function.ts - About 35 mins 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 sampleUniform has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    sampleUniform(dist: number, includeLast = false, result: Vec[] = []) {
        const { index, points } = this;
        const total = this.totalLength();
        const delta = dist / total;
        const n = index.length;
Severity: Minor
Found in packages/geom-resample/src/sampler.ts - About 35 mins 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 __drawPoints has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const __drawPoints = (
    ctx: CanvasRenderingContext2D,
    opts: IObjectOf<any>,
    pts: Iterable<ReadonlyVec>,
    cmd: "fill" | "stroke",
Severity: Minor
Found in packages/hiccup-canvas/src/points.ts - About 35 mins 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 wrap has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const wrap: FnN3 = (x, min, max) => {
    if (min === max) return min;
    if (x > max) {
        const d = max - min;
        x -= d;
Severity: Minor
Found in packages/math/src/interval.ts - About 35 mins 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 assert has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    ? (test: boolean | (() => boolean), msg?: string | (() => string)) => {
            if ((typeof test === "function" && !test()) || !test) {
                throw new AssertionError(
                    typeof msg === "function" ? msg() : msg
                );
Severity: Minor
Found in packages/errors/src/assert.ts - About 35 mins 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 __drawPoints has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const __drawPoints = (
    ctx: CanvasRenderingContext2D,
    opts: IObjectOf<any>,
    pts: ArrayLike<number>,
    cmd: "fill" | "stroke",
Severity: Minor
Found in packages/hiccup-canvas/src/packed-points.ts - About 35 mins 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 cohesion has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const cohesion = (
    maxDist: ScalarOrField,
    weight: ScalarOrField = 1
): IBoidBehavior => {
    const $maxDist = __ensureFn(maxDist);
Severity: Minor
Found in packages/boids/src/behaviors/cohesion.ts - About 35 mins 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 spacesToTabsLine has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const spacesToTabsLine = (line: string, tabSize = 4) => {
    const re = /\s{2,}/g;
    let i = 0;
    let res = "";
    let m: RegExpExecArray | null;
Severity: Minor
Found in packages/strings/src/tabs.ts - About 35 mins 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 compareLex has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const compareLex: Comparator<string> = (a, b) => {
    const ma = BOUNDARY.exec(a);
    const mb = BOUNDARY.exec(b);
    return ma && mb
        ? __compare2(
Severity: Minor
Found in packages/compare/src/string.ts - About 35 mins 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 __mapSubject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    (subject: any) =>
    ([p, o]: [any, any]) => {
        if (isArray(o)) {
            return mapcat(
                (o) =>
Severity: Minor
Found in packages/rstream-query/src/convert.ts - About 35 mins 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 limitSolutions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const limitSolutions = (n: number) =>
    map((sol: Solutions) => {
        if (sol.size <= n) {
            return sol;
        }
Severity: Minor
Found in packages/rstream-query/src/xforms.ts - About 35 mins 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 2 locations. Consider refactoring.
Open

    constructor(
        protected _factor = 1,
        protected _start = 1,
        protected _clamp?: number
    ) {
Severity: Minor
Found in packages/dsp/src/mul.ts and 1 other location - About 35 mins to fix
packages/dsp/src/add.ts on lines 18..25

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

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

    constructor(
        protected _step = 1,
        protected _start = 0,
        protected _clamp?: number
    ) {
Severity: Minor
Found in packages/dsp/src/add.ts and 1 other location - About 35 mins to fix
packages/dsp/src/mul.ts on lines 18..25

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

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

Avoid too many return statements within this function.
Open

        return true;
Severity: Major
Found in packages/trie/src/multi-trie.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

                            return r(
                                acc,
                                fromUtf8CodePoint(
                                    ((u0 & 1) << 30) |
                                        (u1 << 24) |
Severity: Major
Found in packages/transducers-binary/src/utf8.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

                                return r(
                                    acc,
                                    fromUtf8CodePoint(
                                        ((u0 & 3) << 24) |
                                            (u1 << 18) |
Severity: Major
Found in packages/transducers-binary/src/utf8.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return -b.compare(a);
Severity: Major
Found in packages/compare/src/compare.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return a < b ? -1 : a > b ? 1 : 0;
Severity: Major
Found in packages/compare/src/compare.ts - About 30 mins to fix

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

    let num =
        opts && opts.num != null
            ? opts.num
            : ((pts.length - start) / estride) | 0;
Severity: Minor
Found in packages/hiccup-canvas/src/polygon.ts and 2 other locations - About 30 mins to fix
packages/hiccup-canvas/src/packed-points.ts on lines 27..30
packages/hiccup-svg/src/points.ts on lines 71..74

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

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 blit2d has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function blit2d(
    dest: any[],
    dpos: ArrayLike<number>,
    dsize: ArrayLike<number>,
    src: ArrayLike<any>,
Severity: Minor
Found in packages/arrays/src/blit.ts - About 25 mins 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