cloudfoundry-incubator/stratos

View on GitHub

Showing 650 of 1,370 total issues

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

import { SortDirection } from '@angular/material/sort';
import { Action } from '@ngrx/store';
import { getActions } from 'frontend/packages/store/src/actions/action.helper';
import { ApiRequestTypes } from 'frontend/packages/store/src/reducers/api-request-reducer/request-helpers';

    Method HelmRelease.parseManifest has a Cognitive Complexity of 31 (exceeds 8 allowed). Consider refactoring.
    Open

    func (r *HelmRelease) parseManifest() {
        r.ManifestErrors = false
        reader := bytes.NewReader([]byte(r.Manifest))
        buffer := bufio.NewReader(reader)
        var bufr strings.Builder
    Severity: Minor
    Found in src/jetstream/plugins/kubernetes/helm/release.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

    Function get has a Cognitive Complexity of 31 (exceeds 8 allowed). Consider refactoring.
    Open

      get(summary: any, appInstances: AppStat[]): ApplicationStateData {
        const appState: string = summary ? summary.state : 'UNKNOWN';
        const pkgState = this.getPackageState(appState, summary);
        const wildcard = this.stateMetadata['?'];
    
    

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

      constructor(
        public activatedRoute: ActivatedRoute,
        public kubeEndpointService: KubernetesEndpointService
      ) {
        this.podName = activatedRoute.snapshot.params.podName;

      Function setupForGit has 98 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private setupForGit() {
          this.projectInfo$ = this.store.select(selectProjectExists).pipe(
            filter(p => !!p),
            map(p => (!!p.exists && !!p.data) ? p.data : null),
            tap(p => {

        Function getFolderSource has a Cognitive Complexity of 30 (exceeds 8 allowed). Consider refactoring.
        Open

        func getFolderSource(clientWebSocket *websocket.Conn, tempDir string, msg SocketMessage) (StratosProject, string, error) {
            // The msg data is JSON for the Folder info
            info := FolderSourceInfo{
                WaitAfterUpload: false,
            }
        Severity: Minor
        Found in src/jetstream/plugins/cfapppush/deploy.go - About 3 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 shared.module.ts has 327 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { CdkTableModule } from '@angular/cdk/table';
        import { CommonModule } from '@angular/common';
        import { NgModule } from '@angular/core';
        import { FormsModule, ReactiveFormsModule } from '@angular/forms';
        import { RouterModule } from '@angular/router';
        Severity: Minor
        Found in src/frontend/packages/core/src/shared/shared.module.ts - About 3 hrs to fix

          Method CFAppPush.deploy has 121 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (cfAppPush *CFAppPush) deploy(echoContext echo.Context) error {
          
              cnsiGUID := echoContext.Param("cnsiGuid")
              orgGUID := echoContext.Param("orgGuid")
              spaceGUID := echoContext.Param("spaceGuid")
          Severity: Major
          Found in src/jetstream/plugins/cfapppush/deploy.go - About 3 hrs to fix

            Function ngOnInit has 96 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public ngOnInit() {
                const contentElement = this.content.nativeElement;
                const containerElement = this.container.nativeElement;
            
                this.stopped$ = new BehaviorSubject<boolean>(false);

              Method CFHosting.Init has a Cognitive Complexity of 29 (exceeds 8 allowed). Consider refactoring.
              Open

              func (ch *CFHosting) Init() error {
              
                  // Determine if we are running CF by presence of env var "VCAP_APPLICATION" and configure appropriately
                  if ch.portalProxy.Env().IsSet(VCapApplication) {
                      log.Info("Detected that Console is deployed as a Cloud Foundry Application")
              Severity: Minor
              Found in src/jetstream/plugins/cloudfoundryhosting/main.go - About 3 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 Analyzer.doRun has a Cognitive Complexity of 28 (exceeds 8 allowed). Consider refactoring.
              Open

              func (a *Analyzer) doRun(ec echo.Context) error {
              
                  log.Debug("Run analyzer!")
              
                  engine := ec.Param("analyzer")
              Severity: Minor
              Found in src/jetstream/plugins/analysis/container/run.go - About 3 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 ngOnInit has a Cognitive Complexity of 28 (exceeds 8 allowed). Consider refactoring.
              Open

                ngOnInit() {
                  this.hasFavEntities = this.userFavoriteManager.endpointHasEntitiesThatCanFavorite(this.endpoint.cnsi_type);
                  // Favorites for this endpoint
                  this.favorites$ = this.userFavoriteManager.getFavoritesForEndpoint(this.endpoint.guid);
                  this.entity = entityCatalog.getEndpoint(this.endpoint.cnsi_type, this.endpoint.sub_type);

              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 pagination-monitor.ts has 315 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { Store } from '@ngrx/store';
              import { denormalize, schema as normalizrSchema } from 'normalizr';
              import { asapScheduler, combineLatest, Observable, ReplaySubject } from 'rxjs';
              import { tag } from 'rxjs-spy/operators';
              import {
              Severity: Minor
              Found in src/frontend/packages/store/src/monitors/pagination-monitor.ts - About 3 hrs to fix

                File deploy.go has 562 lines of code (exceeds 500 allowed). Consider refactoring.
                Open

                package cfapppush
                
                import (
                    "encoding/base64"
                    "encoding/json"
                Severity: Minor
                Found in src/jetstream/plugins/cfapppush/deploy.go - About 3 hrs to fix

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

                    constructor(
                      ext: ExtensionService,
                      private store: Store<GeneralEntityAppState>,
                      eventService: GlobalEventService,
                      private userFavoriteManager: UserFavoriteManager,
                  Severity: Major
                  Found in src/frontend/packages/core/src/app.module.ts - About 3 hrs to fix

                    Function hash has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      public static hash( string: any ) : string
                      {
                          let temp: string;
                    
                          if ( typeof string !== 'string' )
                    Severity: Major
                    Found in src/frontend/packages/core/src/shared/components/user-avatar/md5.ts - About 3 hrs to fix

                      Function InstallDashboard has a Cognitive Complexity of 27 (exceeds 8 allowed). Consider refactoring.
                      Open

                      func InstallDashboard(p interfaces.PortalProxy, endpointGUID, userGUID string) error {
                          // Download the Yaml for the dashboard
                          kubeDashboardImage := p.Env().String("STRATOS_KUBERNETES_DASHBOARD_IMAGE", "")
                          if len(kubeDashboardImage) == 0 {
                              kubeDashboardImage = dashboardInstallYAMLDownloadURL
                      Severity: Minor
                      Found in src/jetstream/plugins/kubernetes/dashboard/configure.go - About 3 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

                      CfUserPermissionsChecker has 28 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      export class CfUserPermissionsChecker extends BaseCurrentUserPermissionsChecker implements ICurrentUserPermissionsChecker {
                        static readonly ALL_SPACES = 'PERMISSIONS__ALL_SPACES_PLEASE';
                      
                        constructor(private store: Store<GeneralEntityAppState>) {
                          super();

                        ListDataSource has 28 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        export abstract class ListDataSource<T, A = T> extends DataSource<T> implements IListDataSource<T> {
                        
                          // -------------- Public
                          // Core observables
                          public pagination$: Observable<PaginationEntityState>;

                          Function start has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            public start() {
                              if (this.isStarted()) {
                                return;
                              }
                          
                          
                            Severity
                            Category
                            Status
                            Source
                            Language