thi-ng/umbrella

View on GitHub

Showing 759 of 1,895 total issues

Function hasNeighborhood has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    hasNeighborhood<N extends INeighborhood<ReadonlyVec, T>>(
        neighborhood: N,
        opts: Partial<QueryNeighborhoodOpts> = {}
    ) {
        const { entries, indices, items, keyFn, tableSize } = this;
Severity: Minor
Found in packages/geom-accel/src/hash-grid.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 nodes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    *nodes(all = false) {
        let queue: NdQtNode<K, V>[] = [this.root];
        while (queue.length) {
            const n = queue.pop();
            if (n) {
Severity: Minor
Found in packages/geom-accel/src/nd-quadtree-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 cropProc has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const cropProc: Processor = async (spec, input, ctx) => {
    const { aspect, border, gravity, pos, size, ref, unit } = <CropSpec>spec;
    if (border == null && size == null)
        illegalArgs("require `border` or `size` option");
    if (border != null) {
Severity: Minor
Found in packages/imago/src/ops/crop.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 10 (exceeds 5 allowed). Consider refactoring.
Open

        path: ($: Path, eps = 0) => {
            const res: PathSegment[] = [];
            const orig = $.segments;
            const n = orig.length;
            let points!: Vec[] | null;
Severity: Minor
Found in packages/geom/src/simplify.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 readPFM has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const readPFM = (buf: Uint8Array, linearRGB = true) => {
    const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
    if (view.getUint16(0, false) !== 0x5046) __error();
    if (view.getUint8(2) !== 0x0a) __error();
    const idx = buf.indexOf(0x0a, 3);
Severity: Minor
Found in packages/pixel-io-pfm/src/read.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 asPBM has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const asPBM = (buf: IntBuffer, comments?: string[]) => {
    const { data, width, height } = buf;
    const { dest, start, abgr } = initHeader(
        "P4",
        0,
Severity: Minor
Found in packages/pixel-io-netpbm/src/write.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 delete has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    delete(key: K) {
        const $this = __private.get(this)!;
        let node: Maybe<Node<K, V>> = this.findNode(key);
        if (node.k === undefined || $this.cmp(node.k, key) !== 0) return false;
        // descent to lowest level
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 laneStacking has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const laneStacking = <T>(data: [number[], T][], pad = 0) =>
    data.reduce((acc, item) => {
        const rx = item[0];
        for (let i = 0; true; i++) {
            const row = acc[i];
Severity: Minor
Found in packages/viz/src/plot/stacked-intervals.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 10 (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 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 samplePoisson has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const samplePoisson = (_opts: PoissonOpts) => {
    const opts = {
        rnd: SYSTEM,
        iter: 1,
        jitter: 1,
Severity: Minor
Found in packages/poisson/src/poisson.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 braitenberg2 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const braitenberg2 = (
    field: Fn<ReadonlyVec, number>,
    lookahead: number,
    angle: number,
    weight: ScalarOrField = 1
Severity: Minor
Found in packages/boids/src/behaviors/braitenberg.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 normalizeElement has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const normalizeElement = (spec: any[], keys: boolean) => {
    let tag = spec[0];
    let hasAttribs = isPlainObject(spec[1]);
    let match: RegExpExecArray | null;
    let name: string;
Severity: Minor
Found in packages/hdom/src/normalize.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 utf8Decode has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const utf8Decode = (buf: Uint8Array, start: number, num: number) => {
    const end = start + num;
    let i = start;
    let result = "";
    let c: number;
Severity: Minor
Found in packages/strings/src/utf8.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 applyTransform has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const applyTransform = (
    ctx: CanvasRenderingContext2D,
    attribs: IObjectOf<any>
) => {
    let v: any;
Severity: Minor
Found in packages/hiccup-canvas/src/internal/state.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 packageTemplates has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const packageTemplates = <T = any>(
    pkg: Fn<T, Package>,
    opts?: Partial<PackageTemplateOpts>
) => {
    const $opts = {
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

Function add has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    add(): T {
        const v = <CellVec<T>>this.alloc();
        if (v) {
            if (this.tail) {
                v.prev = this.tail;
Severity: Minor
Found in packages/vector-pools/src/linked-list.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 nth has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    nth(n: number): Maybe<T> {
        if (n < 0) {
            n += this._length;
        }
        if (n < 0 || n >= this._length) {
Severity: Minor
Found in packages/vector-pools/src/linked-list.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 defElement has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    <T = Partial<Attribs>, B = any>(
        tag: string,
        baseAttribs?: Partial<T>
    ): ElementFactory<T, B> =>
    (...args: any[]): any => {
Severity: Minor
Found in packages/hiccup-html/src/def.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 3 locations. Consider refactoring.
Open

export function movingMedian<A, B>(
    n: number,
    opts?: Partial<SortOpts<A, B>>
): Transducer<A, A>;
Severity: Major
Found in packages/transducers/src/moving-median.ts and 2 other locations - About 1 hr to fix
packages/transducers/src/partition-sort.ts on lines 39..42
packages/transducers/src/stream-sort.ts on lines 23..26

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

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

export function streamSort<A, B>(
    n: number,
    opts?: Partial<SortOpts<A, B>>
): Transducer<A, A>;
Severity: Major
Found in packages/transducers/src/stream-sort.ts and 2 other locations - About 1 hr to fix
packages/transducers/src/moving-median.ts on lines 19..22
packages/transducers/src/partition-sort.ts on lines 39..42

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

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