cloudfoundry/stratos

View on GitHub

Showing 1,155 of 1,370 total issues

Function isNewer has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring.
Open

  public isNewer(other: Version): boolean {
    if (!this.valid || !other.valid) {
      return false;
    }

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

File application-delete.component.ts has 288 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { DatePipe } from '@angular/common';
import { Component } from '@angular/core';
import { Store } from '@ngrx/store';
import { combineLatest, Observable, ReplaySubject } from 'rxjs';
import { filter, first, map, pairwise, shareReplay, startWith, switchMap, tap } from 'rxjs/operators';

    File space.actions.ts has 287 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { HttpParams, HttpRequest } from '@angular/common/http';
    
    import { getActions } from '../../../store/src/actions/action.helper';
    import { PaginatedAction } from '../../../store/src/types/pagination.types';
    import { ICFAction } from '../../../store/src/types/request.types';
    Severity: Minor
    Found in src/frontend/packages/cloud-foundry/src/actions/space.actions.ts - About 2 hrs to fix

      Function row has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        @Input('row')
        set row(row: APIResource<IServiceInstance>) {
          super.row = row;
          if (row) {
            this.serviceInstanceEntity = row;

        Function processArray has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function processArray(array, output?, nested?: boolean) {
          let format;
          let oneOf;
          let type;
        
        

          Function constructor has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            constructor(
              public applicationService: ApplicationService,
              private store: Store<CFAppState>,
              private endpointsService: EndpointsService,
              private ngZone: NgZone,

            Function getBreadcrumbs has 71 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private getBreadcrumbs(
                application: IApp,
                endpoint: EndpointModel,
                org: APIResource<IOrganization>,
                space: APIResource<ISpace>

              Function constructor has 71 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                constructor(
                  private componentFactoryResolver: ComponentFactoryResolver,
                  public helmReleaseHelper: HelmReleaseHelperService,
                  private store: Store<AppState>,
                  private confirmDialog: ConfirmationDialogService,

                Function processListAction has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private processListAction<T extends BasicKubeAPIResource>(
                    action: KubePaginationAction,
                    url: string) {
                    this.store.dispatch(new StartRequestAction(action));
                
                

                  SpecifyDetailsStepComponent has 25 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  @Component({
                    selector: 'app-specify-details-step',
                    templateUrl: './specify-details-step.component.html',
                    styleUrls: ['./specify-details-step.component.scss'],
                  })

                    Method KubeTerminal.Start has 95 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (k *KubeTerminal) Start(c echo.Context) error {
                        log.Debug("Kube Terminal start request")
                    
                        endpointGUID := c.Param("guid")
                        userGUID := c.Get("user_id").(string)
                    Severity: Major
                    Found in src/jetstream/plugins/kubernetes/terminal/start.go - About 2 hrs to fix

                      Function setupDetailsStep has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        private setupDetailsStep() {
                          this.details = new FormGroup({
                            endpoint: new FormControl('', Validators.required),
                            releaseName: new FormControl('', Validators.required),
                            releaseNamespace: new FormControl('', Validators.required),

                        Method CFAppSSH.appSSH has 94 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (cfAppSsh *CFAppSSH) appSSH(c echo.Context) error {
                            // Need to get info for the endpoint
                            // Get the CNSI and app IDs from route parameters
                            cnsiGUID := c.Param("cnsiGuid")
                            userGUID := c.Get("user_id").(string)
                        Severity: Major
                        Found in src/jetstream/plugins/cfappssh/app_ssh.go - About 2 hrs to fix

                          Method HelmReleaseGraph.ProcessPod has a Cognitive Complexity of 23 (exceeds 8 allowed). Consider refactoring.
                          Open

                          func (r *HelmReleaseGraph) ProcessPod(id string, res KubeResource, spec v1.PodSpec, status v1.PodStatus) {
                              // Look through volumes
                              // name and: PersistentVolumeClaim.ClaimName or Secret.SecretName
                              for _, volume := range spec.Volumes {
                                  if volume.VolumeSource.PersistentVolumeClaim != nil {
                          Severity: Minor
                          Found in src/jetstream/plugins/kubernetes/helm/graph.go - 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 findDatabaseConfig has a Cognitive Complexity of 23 (exceeds 8 allowed). Consider refactoring.
                          Open

                          func findDatabaseConfig(vcapServices map[string][]VCAPService, db *DatabaseConfig, env *env.VarSet) bool {
                              var service VCAPService
                              configs := findDatabaseConfigurations(vcapServices)
                              log.Infof("Found %d database service instances", len(configs))
                              for _, s := range configs {
                          Severity: Minor
                          Found in src/jetstream/datastore/database_cf_config.go - 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 update has a Cognitive Complexity of 23 (exceeds 8 allowed). Consider refactoring.
                          Open

                            update(): void {
                              let width;
                              if (this.series.length) {
                                width = this.xScale.bandwidth();
                                this.bandwidth.emit(width);

                          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 processObject has a Cognitive Complexity of 23 (exceeds 8 allowed). Consider refactoring.
                          Open

                          function processObject(object: any, output?: any, nested?: boolean) {
                            if (nested && output) {
                              output = { properties: output };
                            } else {
                              output = output || {};

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

                          export function dashboardReducer(state: DashboardState = defaultDashboardState, action): DashboardState {
                            switch (action.type) {
                              case OPEN_SIDE_NAV:
                                if (state.isMobile) {
                                  return { ...state, isMobileNavOpen: true };
                          Severity: Major
                          Found in src/frontend/packages/store/src/reducers/dashboard-reducer.ts - About 2 hrs to fix

                            File application-state.service.ts has 279 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { Injectable } from '@angular/core';
                            
                            import { StratosStatus, StratosStatusMetadata } from '../../../../store/src/types/shared.types';
                            import { AppStat } from '../../store/types/app-metadata.types';
                            
                            

                              File manage-users-modify.component.ts has 279 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import {
                                ChangeDetectorRef,
                                Component,
                                ComponentFactory,
                                ComponentFactoryResolver,
                                Severity
                                Category
                                Status
                                Source
                                Language