satanTime/ngrx-entity-relationship

View on GitHub

Showing 26 of 44 total issues

Function normalizeSelector has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function normalizeSelector<S, E>(
    selector: FEATURE_SELECTOR<S, E>,
): {
    collection: STORE_SELECTOR<S, ENTITY_STATE<E>>;
    id: ID_SELECTOR<E>;
Severity: Minor
Found in libs/ngrx-entity-relationship/src/lib/utils.ts - About 1 hr to fix

    Function rootEntitySelector has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
    Open

    export function rootEntitySelector<STORE, ENTITY, TRANSFORMED>(
        featureSelector: FEATURE_SELECTOR<STORE, ENTITY>,
        guess1?: SELECTOR_META | TRANSFORMER<ENTITY, TRANSFORMED>,
        guess2?: SELECTOR_META,
    ): (
    Severity: Minor
    Found in libs/ngrx-entity-relationship/src/lib/rootEntitySelector.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 verifyCache has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
    Open

    export function verifyCache<S>(state: S, checks: CACHE_CHECKS_SET<S>): boolean {
        if (!checks.size) {
            return false;
        }
        const checksData: Array<[STORE_SELECTOR<S, ENTITY_STATE<UNKNOWN>>, CACHE_CHECKS]> = [];
    Severity: Minor
    Found in libs/ngrx-entity-relationship/src/lib/utils.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 callback has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        const callback = (
            state: STORE,
            idsOrSelector: undefined | null | Array<ID_TYPES> | STORE_SELECTOR<STORE, undefined | null | Array<ID_TYPES>>,
        ) => {
            const ids = typeof idsOrSelector === 'function' ? idsOrSelector(state) : idsOrSelector;
    Severity: Minor
    Found in libs/ngrx-entity-relationship/src/lib/rootEntities.ts - About 1 hr to fix

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

      export function verifyCache<S>(state: S, checks: CACHE_CHECKS_SET<S>): boolean {
          if (!checks.size) {
              return false;
          }
          const checksData: Array<[STORE_SELECTOR<S, ENTITY_STATE<UNKNOWN>>, CACHE_CHECKS]> = [];
      Severity: Minor
      Found in libs/ngrx-entity-relationship/src/lib/utils.ts - About 1 hr to fix

        Function func has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
        Open

        const func = (state: any, selector: ENTITY_SELECTOR, data: any) => {
            const map = extractMap(selector, new Map());
            for (const [key, {selectors, skipFields}] of mapEntries(map)) {
                const isSet = Array.isArray(data[key]);
                const entities = isSet ? data[key] : [data[key]];
        Severity: Minor
        Found in libs/ngrx-entity-relationship/src/lib/store/fromFlat.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

        Severity
        Category
        Status
        Source
        Language