cloudfoundry/stratos

View on GitHub

Showing 718 of 1,370 total issues

Function createPodExpandedStatus has a Cognitive Complexity of 45 (exceeds 8 allowed). Consider refactoring.
Open

  static createPodExpandedStatus(pod: KubernetesPod): KubernetesPodExpandedStatus {

    let restarts = 0;
    const totalContainers = pod.spec.containers ? pod.spec.containers.length : 0;
    let readyContainers = 0;

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 main has 183 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func main() {

    // Register time.Time in gob
    gob.Register(time.Time{})

Severity: Major
Found in src/jetstream/main.go - About 6 hrs to fix

    Function generateCFEntities has 153 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function generateCFEntities(): StratosBaseCatalogEntity[] {
      const endpointDefinition: StratosEndpointExtensionDefinition = {
        urlValidationRegexString: urlValidationExpression,
        type: CF_ENDPOINT_TYPE,
        label: 'Cloud Foundry',
    Severity: Major
    Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 6 hrs to fix

      File list-data-source.ts has 420 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { DataSource } from '@angular/cdk/table';
      import { SortDirection } from '@angular/material/sort';
      import { Store } from '@ngrx/store';
      import {
        BehaviorSubject,

        File cloud-foundry-section.routing.ts has 415 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { NgModule } from '@angular/core';
        import { RouterModule, Routes } from '@angular/router';
        
        import { DynamicExtensionRoutes } from '../../../../core/src/core/extension/dynamic-extension-routes';
        import { StratosActionType } from '../../../../core/src/core/extension/extension-service';

          File cnsi.go has 660 lines of code (exceeds 500 allowed). Consider refactoring.
          Open

          package main
          
          import (
              "crypto/x509"
              "encoding/json"
          Severity: Minor
          Found in src/jetstream/cnsi.go - About 5 hrs to fix

            Method CustomBinder.bindData has a Cognitive Complexity of 41 (exceeds 8 allowed). Consider refactoring.
            Open

            func (b *CustomBinder) bindData(ptr interface{}, data map[string][]string, tag string) error {
                typ := reflect.TypeOf(ptr).Elem()
                val := reflect.ValueOf(ptr).Elem()
            
                if typ.Kind() != reflect.Struct {
            Severity: Minor
            Found in src/jetstream/custombinder/custombinder.go - About 5 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

            File deploy-application-deployer.ts has 405 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { Store } from '@ngrx/store';
            import { BehaviorSubject, of as observableOf, Subject, Subscription } from 'rxjs';
            import websocketConnect from 'rxjs-websockets';
            import { catchError, combineLatest, filter, first, map, mergeMap, share, switchMap, tap } from 'rxjs/operators';
            
            

              File helm.effects.ts has 398 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { HttpClient } from '@angular/common/http';
              import { Injectable } from '@angular/core';
              import { MatSnackBar } from '@angular/material/snack-bar';
              import { Actions, Effect, ofType } from '@ngrx/effects';
              import { Action, Store } from '@ngrx/store';
              Severity: Minor
              Found in src/frontend/packages/kubernetes/src/helm/store/helm.effects.ts - About 5 hrs to fix

                File cf-org-card.component.spec.ts has 396 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { async, ComponentFixture, TestBed } from '@angular/core/testing';
                import { Store } from '@ngrx/store';
                import { testSessionData } from '@stratosui/store/testing';
                
                import { ConfirmationDialogService } from '../../../../../../../../core/src/shared/components/confirmation-dialog.service';

                  Function endpointActions has 136 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    endpointActions(includeSeparators = false): IListAction<EndpointModel>[] {
                      // Add any additional actions that are per endpoint type
                      const customActions = entityCatalog.getAllEndpointTypes()
                        .map(endpoint => endpoint.definition.endpointListActions)
                        .filter(endpointListActions => !!endpointListActions)

                    File cf-user.service.ts has 391 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { Injectable } from '@angular/core';
                    import { Store } from '@ngrx/store';
                    import { combineLatest, Observable, of as observableOf, of, ReplaySubject } from 'rxjs';
                    import { filter, first, map, multicast, publishReplay, refCount, startWith, switchMap } from 'rxjs/operators';
                    
                    

                      Function initialise has a Cognitive Complexity of 38 (exceeds 8 allowed). Consider refactoring.
                      Open

                        private initialise() {
                          this.globalActions = this.setupActionsDefaultObservables(
                            this.config.getGlobalActions()
                          );
                          this.multiActions = this.setupActionsDefaultObservables(

                      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 cf.helpers.ts has 380 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { ActivatedRoute } from '@angular/router';
                      import { Store } from '@ngrx/store';
                      import { combineLatest, Observable } from 'rxjs';
                      import { filter, first, map, publishReplay, refCount, switchMap, tap } from 'rxjs/operators';
                      
                      
                      Severity: Minor
                      Found in src/frontend/packages/cloud-foundry/src/features/cf/cf.helpers.ts - About 5 hrs to fix

                        Function main has a Cognitive Complexity of 37 (exceeds 8 allowed). Consider refactoring.
                        Open

                        func main() {
                        
                            // Register time.Time in gob
                            gob.Register(time.Time{})
                        
                        
                        Severity: Minor
                        Found in src/jetstream/main.go - About 5 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

                        Method portalProxy.ProxyRequest has a Cognitive Complexity of 37 (exceeds 8 allowed). Consider refactoring.
                        Open

                        func (p *portalProxy) ProxyRequest(c echo.Context, uri *url.URL) (map[string]*interfaces.CNSIRequest, error) {
                            log.Debug("ProxyRequest")
                            cnsiList := strings.Split(c.Request().Header.Get("x-cap-cnsi-list"), ",")
                            shouldPassthrough := "true" == c.Request().Header.Get("x-cap-passthrough")
                            longRunning := "true" == c.Request().Header.Get(longRunningTimeoutHeader)
                        Severity: Minor
                        Found in src/jetstream/passthrough.go - About 5 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

                        Method portalProxy.DoRegisterEndpoint has a Cognitive Complexity of 36 (exceeds 8 allowed). Consider refactoring.
                        Open

                        func (p *portalProxy) DoRegisterEndpoint(cnsiName string, apiEndpoint string, skipSSLValidation bool, clientId string, clientSecret string, userId string, ssoAllowed bool, subType string, createSystemEndpoint bool, fetchInfo interfaces.InfoFunc) (interfaces.CNSIRecord, error) {
                            log.Debug("DoRegisterEndpoint")
                        
                            if len(cnsiName) == 0 || len(apiEndpoint) == 0 {
                                return interfaces.CNSIRecord{}, interfaces.NewHTTPShadowError(
                        Severity: Minor
                        Found in src/jetstream/cnsi.go - About 4 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

                        File autoscaler-tab-extension.component.ts has 369 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { Component, OnDestroy, OnInit } from '@angular/core';
                        import { MatSnackBar, MatSnackBarRef, SimpleSnackBar } from '@angular/material/snack-bar';
                        import { ActivatedRoute } from '@angular/router';
                        import { Store } from '@ngrx/store';
                        import { combineLatest, Observable, of, Subscription } from 'rxjs';

                          File combo-chart.component.ts has 365 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import {
                            Component,
                            ContentChild,
                            EventEmitter,
                            HostListener,

                            File cf-shared.module.ts has 365 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { CommonModule } from '@angular/common';
                            import { ApplicationModule, NgModule, Type } from '@angular/core';
                            import { MaterialDesignFrameworkModule } from '@cfstratos/ajsf-material';
                            
                            import { CoreModule } from '../../../core/src/core/core.module';
                            Severity: Minor
                            Found in src/frontend/packages/cloud-foundry/src/shared/cf-shared.module.ts - About 4 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language