Codibre/effi-find

View on GitHub

Showing 8 of 8 total issues

Function partitionRange has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

function partitionRange<
    T extends object,
    Init extends KeysOfType<T, number>,
    End extends KeysOfType<T, number>,
>(
Severity: Minor
Found in src/chooser-factory.ts - About 3 hrs 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

File chooser-factory.ts has 292 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-magic-numbers */
import { fluent, identity } from '@codibre/fluent-iterable';
Severity: Minor
Found in src/chooser-factory.ts - About 3 hrs to fix

    Function partitionRange has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function partitionRange<
        T extends object,
        Init extends KeysOfType<T, number>,
        End extends KeysOfType<T, number>,
    >(
    Severity: Major
    Found in src/chooser-factory.ts - About 2 hrs to fix

      Function next has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          next(): IteratorResult<{ value: T }> {
              if (this.item === undefined) this.item = this.iterator.next();
              if (this.item.done) return { done: true, value: undefined };
              const item = this.item.value as
                  | undefined
      Severity: Minor
      Found in src/chooser-factory.ts - About 1 hr to fix

        Function chooserFactory has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function chooserFactory<
            T extends object,
            Keys extends Array<ChooseMapper<T>>,
        >(list: T[], ...keys: Keys): Chooser<Keys, T> {
            let normalized: Iterable<{ value: T }> = fluent(list).map((value) => ({
        Severity: Minor
        Found in src/chooser-factory.ts - About 1 hr to fix

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

              next(): IteratorResult<{ value: T }> {
                  if (this.item === undefined) this.item = this.iterator.next();
                  if (this.item.done) return { done: true, value: undefined };
                  const item = this.item.value as
                      | undefined
          Severity: Minor
          Found in src/chooser-factory.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 getItem has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              base: T | undefined,
              initSymbol: InitSymbol,
              endSymbol: EndSymbol,
              init: Init,
              multiplier: number,
          Severity: Minor
          Found in src/chooser-factory.ts - About 45 mins to fix

            Function partitionRange has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                original: T[],
                list: Iterable<{ value: T }>,
                init: Init,
                end: End,
                precision = 2,
            Severity: Minor
            Found in src/chooser-factory.ts - About 35 mins to fix
              Severity
              Category
              Status
              Source
              Language