cloudfoundry-incubator/stratos

View on GitHub

Showing 1,111 of 1,370 total issues

Function cfUsersRolesReducer has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function cfUsersRolesReducer(state: UsersRolesState = defaultState, action: Action): UsersRolesState {
  switch (action.type) {
    case UsersRolesActions.SetUsers:
      const setUsersAction = action as UsersRolesSetUsers;
      const orgGuid = state.newRoles ? state.newRoles.orgGuid : '';

    Method KubeTerminal.createPod has 98 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (k *KubeTerminal) createPod(c echo.Context, kubeConfig, kubeVersion string, ws *websocket.Conn) (*PodCreationData, error) {
        // Unique ID for the secret and pod name
        id := uuid.NewV4().String()
        id = strings.ReplaceAll(id, "-", "")
        // Names for the secret and pod
    Severity: Major
    Found in src/jetstream/plugins/kubernetes/terminal/helpers.go - About 2 hrs to fix

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

      func (p *portalProxy) getInfo(c echo.Context) (*interfaces.Info, error) {
          // get the version
          versions, err := p.getVersionsData()
          if err != nil {
              return nil, errors.New("Could not find database version")
      Severity: Minor
      Found in src/jetstream/info.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

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

      func (p *portalProxy) xsrfMiddlewareWithConfig(config MiddlewareConfig) echo.MiddlewareFunc {
          // Default skipper function always returns false
          if config.Skipper == nil {
              config.Skipper = func(c echo.Context) bool { return false }
          }
      Severity: Minor
      Found in src/jetstream/middleware.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 setupForGit has a Cognitive Complexity of 24 (exceeds 8 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 => {

      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 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

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

          function setupOrgLevelTest(selectAddRemove: (rb: RadioGroup) => void, checkInitialState: () => void, checkFinishingState: () => void) {
            it('Check initial state and get to stepper', () => {
              checkInitialState();
      
              orgPage.subHeader.hasIconButton('people');

        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(
              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));
            
            

              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 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

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

                    import {
                      ChangeDetectorRef,
                      Component,
                      ComponentFactory,
                      ComponentFactoryResolver,

                      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';
                      
                      

                        Function exports has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        module.exports = function (project) {
                          var path = require('path')
                          var repoRoot = path.join(__dirname, '..')
                          return function (config) {
                        
                        
                        Severity: Major
                        Found in build/karma.conf.creator.js - About 2 hrs to fix

                          Function initialiseSpaceObservables has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            private initialiseSpaceObservables() {
                              this.space$ = this.cfUserService.isConnectedUserAdmin(this.cfGuid).pipe(
                                switchMap(isAdmin => {
                                  const relations = [
                                    createEntityRelationKey(spaceEntityType, spaceQuotaEntityType),
                            Severity
                            Category
                            Status
                            Source
                            Language