tdreyno/pretty-please

View on GitHub

Showing 6 of 32 total issues

Task has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

export class Task<E, S> implements PromiseLike<S> {
  public static fail = fail
  public static succeed = succeed
  public static empty = empty
  public static failIn = failIn
Severity: Minor
Found in src/Task/Task.ts - About 3 hrs to fix

    Function sequence has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      new Task((reject, resolve) => {
        let isDone = false
    
        type TaskPosition = [Task<E, S>, number]
    
    
    Severity: Minor
    Found in src/Task/Task.ts - About 1 hr to fix

      Function ap has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      export const ap = <E, S, S2>(
        task: Task<E, (result: S) => S2>,
        appliedTask: Task<E, S>,
      ): Task<E, S2> =>
        new Task((reject, resolve) => {
      Severity: Minor
      Found in src/Task/Task.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 enqueue has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          const enqueue = () => {
            if (isDone) {
              return
            }
      
      
      Severity: Minor
      Found in src/Task/Task.ts - About 1 hr to fix

        Function loop has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export const loop = <E, S, T>(
          fn: (currentValue: T) => Task<E, LoopBreak<S> | LoopContinue<T>>,
          initialValue: T,
        ): Task<E, S> =>
          new Task((reject, resolve) => {
        Severity: Minor
        Found in src/Task/Task.ts - About 45 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 sequence has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        export const sequence = <E, S>(
          tasks: Array<Task<E, S>>,
          maxConcurrent = 1,
        ): Task<E, S[]> =>
          new Task((reject, resolve) => {
        Severity: Minor
        Found in src/Task/Task.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

        Severity
        Category
        Status
        Source
        Language