thi-ng/umbrella

View on GitHub

Showing 378 of 1,891 total issues

Function __readInt has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const __readInt = (iter: Iterator<number>, acc: number, end = Lit.END) => {
    let i: IteratorResult<number>;
    let x: number;
    let isSigned = false;
    while (!(i = iter.next()).done) {
Severity: Minor
Found in packages/bencode/src/decode.ts - About 55 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 __sampleAttribs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const __sampleAttribs = (
    opts?: number | Partial<SamplingOpts>,
    attribs?: Attribs
): Maybe<number | Partial<SamplingOpts>> => {
    if (attribs) {
Severity: Minor
Found in packages/geom/src/internal/vertices.ts - About 55 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 diagonalEnds2d has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function* diagonalEnds2d(opts: GridIterOpts2D & { all?: boolean }) {
    const { cols, rows, tx } = __opts(opts);
    const num = cols * rows - 1;
    const maxX = cols - 1;
    const maxY = rows - 1;
Severity: Minor
Found in packages/grid-iterators/src/diagonal-ends.ts - About 55 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 merge has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const merge: FnU2<VClock> = (a, b) =>
    [...__uniqueIDs(a, b)].reduce((acc, id) => {
        const va = a[id];
        const vb = b[id];
        acc[id] =
Severity: Minor
Found in packages/vclock/src/index.ts - About 55 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 percolateDown has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected percolateDown(i: number, vals = this.values) {
        const n = vals.length;
        const d = this.d;
        const node = vals[i];
        const cmp = this.compare;
Severity: Minor
Found in packages/heaps/src/dheap.ts - About 55 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 __compileSpec has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const __compileSpec = ({
    rule,
    kernel,
    positional,
    states,
Severity: Minor
Found in packages/cellular/src/1d.ts - About 55 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 __generateFields has a Cognitive Complexity of 9 (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/zig.ts - About 55 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 __files has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function* __files(
    dir: string,
    match: string | RegExp | Predicate<string> = "",
    logger?: ILogger,
    maxDepth = Infinity,
Severity: Minor
Found in packages/file-io/src/files.ts - About 55 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 __endShape has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const __endShape = (
    ctx: CanvasRenderingContext2D,
    attribs: IObjectOf<any>,
    doFill = true
) => {
Severity: Minor
Found in packages/hiccup-canvas/src/internal/end-shape.ts - About 55 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 shuffle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    shuffle(iter?: number, rnd: IRandom = SYSTEM) {
        if (this._length < 2) return this;
        for (
            iter =
                iter !== undefined
Severity: Minor
Found in packages/dcons/src/dcons.ts - About 55 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 next has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    next(x: A) {
        if (this.state < State.DONE) {
            let tx;
            if (this.transferables) {
                tx = this.transferables(x);
Severity: Minor
Found in packages/rstream/src/tunnel.ts - About 55 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 __normalizeArray has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

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

    read(wordSize = 1, safe = true): number {
        if (wordSize > 32) {
            return this.read(wordSize - 32, safe) * U32 + this.read(32, safe);
        } else if (wordSize > 8) {
            let out = 0;
Severity: Minor
Found in packages/bitstream/src/input.ts - About 55 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 write has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    write(x: number, wordSize = 1) {
        if (wordSize > 32) {
            let hi = Math.floor(x / U32);
            this.write(hi, wordSize - 32);
            this.write(x - hi * U32, 32);
Severity: Minor
Found in packages/bitstream/src/output.ts - About 55 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 solveCubic has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const solveCubic = (
    a: number,
    b: number,
    c: number,
    d: number,
Severity: Minor
Found in packages/math/src/solve.ts - About 55 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 image has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const image = (
    ctx: CanvasRenderingContext2D,
    _: IObjectOf<any>,
    { width, height }: IObjectOf<any>,
    img:
Severity: Minor
Found in packages/hiccup-canvas/src/image.ts - About 55 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 renameTransformedKeys has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const renameTransformedKeys = <T extends object, K extends keyof T>(
    src: Nullable<T>,
    keys: Record<K, PropertyKey | [PropertyKey, Fn2<any, T, any>]>
) => {
    if (!src) return {};
Severity: Minor
Found in packages/object-utils/src/rename-keys.ts - About 55 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 insert has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    insert(i: number): Maybe<T> {
        if (!this._length) {
            return i === 0 ? this.add() : undefined;
        }
        const q = <CellVec<T>>this.nth(i);
Severity: Minor
Found in packages/vector-pools/src/linked-list.ts - About 55 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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        ext: (e, _, acc) => {
            acc.push(
                `// external type: ${e.name} (size: ${e.size}, align: ${e.align})\n`
            );
        },
Severity: Minor
Found in packages/wasm-api-bindgen/src/c11.ts and 1 other location - About 55 mins to fix
packages/wasm-api-bindgen/src/zig.ts on lines 83..87

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

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        ext: (e, _, acc) => {
            acc.push(
                `// external type: ${e.name} (size: ${e.size}, align: ${e.align})\n`
            );
        },
Severity: Minor
Found in packages/wasm-api-bindgen/src/zig.ts and 1 other location - About 55 mins to fix
packages/wasm-api-bindgen/src/c11.ts on lines 129..133

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

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