AutoScheduleJS/queries-scheduler

View on GitHub
src/data-flows/pipes.flow.ts

Summary

Maintainability
C
1 day
Test Coverage

File pipes.flow.ts has 443 lines of code (exceeds 350 allowed). Consider refactoring.
Open

import { IQueryPositionDurationInternal, ITimeDurationInternal } from '@autoschedule/queries-fn';
import { intersect, split, substract } from 'intervals-fn';
import * as R from 'ramda';
import { BehaviorSubject } from 'rxjs';
import { IConfig } from '../data-structures/config.interface';
Severity: Minor
Found in src/data-flows/pipes.flow.ts - About 4 hrs to fix

    Function findMaxFinitePlacement has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const findMaxFinitePlacement = (
      toPlace: IPotentiality,
      updatePP: (m: IMaterial[]) => IPotentiality[],
      pressure: IPressureChunk[],
      error$: BehaviorSubject<any>
    Severity: Minor
    Found in src/data-flows/pipes.flow.ts - About 1 hr to fix

      Function computeContiguousPressureChunk has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const computeContiguousPressureChunk = (
        potential: IPotentialitySimul,
        chunks: IPressureChunk[]
      ): IPressureChunk | null => {
        if (!chunks.length) {
      Severity: Minor
      Found in src/data-flows/pipes.flow.ts - About 1 hr to fix

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

        const findMaxFinitePlacement = (
          toPlace: IPotentiality,
          updatePP: (m: IMaterial[]) => IPotentiality[],
          pressure: IPressureChunk[],
          error$: BehaviorSubject<any>
        Severity: Minor
        Found in src/data-flows/pipes.flow.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 reducePlaceToRange has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        const reducePlaceToRange = (kind: 'start' | 'end') => (places: ReadonlyArray<IPotRange>) =>
          places.reduce(
            (acc, cur) => ({
              end: cur.kind === kind || cur.kind.endsWith('after') ? cur.end : acc.end,
              start: cur.kind === kind || cur.kind.endsWith('before') ? cur.start : acc.start,
        Severity: Minor
        Found in src/data-flows/pipes.flow.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 adjustAreaPressure has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const adjustAreaPressure = (pot: IPotentialitySimul, places: ReadonlyArray<IPotRange>) => (
          chunk: IAreaPressureChunk
        ): IPressureChunk => {
          return places.reduce((acc, cur) => {
            const computePressureFactor = computePressureFactorFn(cur, pot.pressure);
        Severity: Minor
        Found in src/data-flows/pipes.flow.ts - About 25 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

        There are no issues that match your filters.

        Category
        Status