SUSE/stratos

View on GitHub
src/frontend/packages/cloud-foundry/src/shared/data-services/cf-org-space-service.service.ts

Summary

Maintainability
C
1 day
Test Coverage

File cf-org-space-service.service.ts has 332 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Injectable, OnDestroy } from '@angular/core';
import { Store } from '@ngrx/store';
import { BehaviorSubject, combineLatest, Observable, of, Subscription } from 'rxjs';
import {
  distinctUntilChanged,

    Function setupAutoSelectors has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private setupAutoSelectors(initialCf: string, initialOrg: string) {
        // Clear or automatically select org + space given cf
        let cfTapped = false;
        const orgResetSub = this.cf.select.asObservable().pipe(
          startWith(initialCf),

      Function createCfOrSpaceMultipleFilterFn has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const createCfOrSpaceMultipleFilterFn = (
        store: Store<CFAppState>,
        action: PaginatedAction,
        setQParam: (setQ: QParam, qs: QParam[]) => boolean,
        preResetUpdate?: () => void

        Function createCfOrSpaceMultipleFilterFn has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring.
        Open

        export const createCfOrSpaceMultipleFilterFn = (
          store: Store<CFAppState>,
          action: PaginatedAction,
          setQParam: (setQ: QParam, qs: QParam[]) => boolean,
          preResetUpdate?: () => void

        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 createCf has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private createCf() {
            const list$ = this.store.select(connectedEndpointsOfTypesSelector(CF_ENDPOINT_TYPE)).pipe(
              // Ensure we have endpoints
              filter(endpoints => endpoints && !!Object.keys(endpoints).length),
              publishReplay(1),

          Function setupAutoSelectors has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
          Open

            private setupAutoSelectors(initialCf: string, initialOrg: string) {
              // Clear or automatically select org + space given cf
              let cfTapped = false;
              const orgResetSub = this.cf.select.asObservable().pipe(
                startWith(initialCf),

          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