sonewman/meditate

View on GitHub

Showing 6 of 16 total issues

Function createOrchestratorObserver has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

function createOrchestratorObserver<T, R>(
  observer: SubscriptionObserver<R>,
  orchestrator: Orchestrator<T, R>
): Orchestrator.Observer<R> {

Severity: Minor
Found in src/Orchestrator.ts - About 2 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

Function createOrchestratorObserver has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createOrchestratorObserver<T, R>(
  observer: SubscriptionObserver<R>,
  orchestrator: Orchestrator<T, R>
): Orchestrator.Observer<R> {

Severity: Minor
Found in src/Orchestrator.ts - About 1 hr to fix

    Function reduce has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      reduce<R>(...args: [ReduceFn<T, R>] | [ReduceFn<T, R>, R]): Observable<R> {
        return new Observable<R>(async observer => {
          let pending = 0;
          let completed = false;
          let hasError = false;
    Severity: Minor
    Found in src/Observable.ts - About 1 hr to fix

      Function iterate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export async function iterate<T>(
        iterable: Iterable<T | Promise<T>> | AsyncIterable<T | Promise<T>>,
        next: (value: T) => any,
        error: (err: unknown) => any,
        complete: () => any
      Severity: Minor
      Found in src/iterate.ts - About 1 hr to fix

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

          constructor(observable: Observable<T>) {
        
            const handleEvent = (event: ObservableEvent<T>) => queueMicrotask(async () => {
        
              const nextFuture = this.pendingFutures.shift();
        Severity: Minor
        Found in src/AsyncGenerator.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 iterate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        export async function iterate<T>(
          iterable: Iterable<T | Promise<T>> | AsyncIterable<T | Promise<T>>,
          next: (value: T) => any,
          error: (err: unknown) => any,
          complete: () => any
        Severity: Minor
        Found in src/iterate.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