cloudfoundry-incubator/stratos

View on GitHub

Showing 650 of 1,370 total issues

Function createStoreState has 858 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function createStoreState(): Partial<AppState<BaseEntityValues>> {
    // Data
    const endpoints: EndpointModel[] = [
      {
        guid: '0e934dc8-7ad4-40ff-b85c-53c1b61d2abb',

    File current-user-permissions-and-cfchecker.service.spec.ts has 1026 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { TestBed } from '@angular/core/testing';
    import { createBasicStoreModule, createEntityStoreState, TestStoreEntity } from '@stratosui/store/testing';
    import { first, tap } from 'rxjs/operators';
    
    import { PermissionConfig } from '../../../../core/src/core/permissions/current-user-permissions.config';

      Function createStoreState has 427 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function createStoreState(): Partial<AppState<BaseEntityValues>> {
          // Data
          const endpoints: EndpointModel[] = [
            {
              guid: '0e934dc8-7ad4-40ff-b85c-53c1b61d2abb',

        File list.component.ts has 649 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { animate, style, transition, trigger } from '@angular/animations';
        import {
          AfterViewInit,
          ChangeDetectorRef,
          Component,

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

            constructor() {
              const endpointDef: StratosEndpointExtensionDefinition = {
                type: KUBERNETES_ENDPOINT_TYPE,
                label: 'Kubernetes',
                labelPlural: 'Kubernetes',

            File main.go has 891 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            package main
            
            import (
                "crypto/sha1"
                "crypto/tls"
            Severity: Major
            Found in src/jetstream/main.go - About 1 day to fix

              File kubernetes-entity-generator.ts has 599 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { Compiler, Injector } from '@angular/core';
              import { Validators } from '@angular/forms';
              import moment from 'moment';
              
              import { BaseEndpointAuth } from '../../../core/src/core/endpoint-auth';

                Function initialise has 255 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Method KubeTerminal.cleanup has a Cognitive Complexity of 58 (exceeds 8 allowed). Consider refactoring.
                  Open

                  func (k *KubeTerminal) cleanup() {
                      // Use a random initial wait before cleaning up
                      // If we had more than one backend, this helps to ensure they are not all trying to cleanup at the same time
                      wait := rand.Intn(30)
                      log.Debug("Kubernetes Terminal cleanup will start in %d minutes", wait)
                  Severity: Minor
                  Found in src/jetstream/plugins/kubernetes/terminal/cleanup.go - About 1 day 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 application-autoscaler-e2e.spec.ts has 503 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import moment from 'moment-timezone';
                  import { browser, promise } from 'protractor';
                  import { timer } from 'rxjs';
                  import { switchMap } from 'rxjs/operators';
                  
                  
                  Severity: Major
                  Found in src/test-e2e/application/application-autoscaler-e2e.spec.ts - About 1 day to fix

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

                    import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
                    import { Injectable } from '@angular/core';
                    import { Actions, Effect, ofType } from '@ngrx/effects';
                    import { Action, Store } from '@ngrx/store';
                    import { ClearPaginationOfEntity, ClearPaginationOfType } from 'frontend/packages/store/src/actions/pagination.actions';

                      File kube.types.ts has 499 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { Observable } from 'rxjs';
                      
                      import {
                        OrchestratedActionBuilderConfig,
                        OrchestratedActionBuilders,
                      Severity: Minor
                      Found in src/frontend/packages/kubernetes/src/kubernetes/store/kube.types.ts - About 1 day to fix

                        File current-user-permissions.service.spec.ts has 497 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { TestBed } from '@angular/core/testing';
                        import { createBasicStoreModule, createEntityStoreState, TestStoreEntity } from '@stratosui/store/testing';
                        import { first, tap } from 'rxjs/operators';
                        
                        import { AppState } from '../../../../store/src/app-state';

                          Function processArray has a Cognitive Complexity of 51 (exceeds 8 allowed). Consider refactoring.
                          Open

                          function processArray(array, output?, nested?: boolean) {
                            let format;
                            let oneOf;
                            let 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 cf-e2e-helpers.ts has 462 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { browser, promise } from 'protractor';
                          
                          import {
                            IApp,
                            IDomain,
                          Severity: Minor
                          Found in src/test-e2e/helpers/cf-e2e-helpers.ts - About 7 hrs to fix

                            Function createApplicationDeployTests has 172 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function createApplicationDeployTests(type = CREATE_APP_DEPLOY_TEST_TYPE.GIT_CLONE): {
                              testApp: string,
                              testAppName: string,
                              deployedCommit: promise.Promise<string>,
                              appDetails: {
                            Severity: Major
                            Found in src/test-e2e/application/application-deploy-helper.ts - About 6 hrs to fix

                              CFHelpers has 49 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              export class CFHelpers {
                                static cachedDefaultCfGuid: string;
                                static cachedDefaultOrgGuid: string;
                                static cachedDefaultSpaceGuid: string;
                                static cachedAdminGuid: string;
                              Severity: Minor
                              Found in src/test-e2e/helpers/cf-e2e-helpers.ts - About 6 hrs to fix

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

                                func (p *portalProxy) updateEndpoint(ec echo.Context) error {
                                    log.Debug("updateEndpoint")
                                
                                    params := new(interfaces.UpdateEndpointParams)
                                    if err := ec.Bind(params); err != nil {
                                Severity: Minor
                                Found in src/jetstream/cnsi.go - About 6 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 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

                                File cf-user-permissions-checkers.ts has 432 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import { Store } from '@ngrx/store';
                                import { combineLatest, Observable, of } from 'rxjs';
                                import { distinctUntilChanged, filter, map, switchMap } from 'rxjs/operators';
                                
                                import {
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language