cloudfoundry/stratos

View on GitHub

Showing 718 of 1,370 total issues

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

import { Compiler, Injector } from '@angular/core';
import { Action, Store } from '@ngrx/store';
import { entityFetchedWithoutError } from '@stratosui/store';
import { combineLatest, Observable, of } from 'rxjs';
import { first, map } from 'rxjs/operators';
Severity: Major
Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 2 days to fix

    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(

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

              import { HttpClient, HttpErrorResponse } from '@angular/common/http';
              import { Injectable } from '@angular/core';
              import { Actions, Effect, ofType } from '@ngrx/effects';
              import { Action, Store } from '@ngrx/store';
              import { Observable } from 'rxjs';
              Severity: Major
              Found in src/frontend/packages/cf-autoscaler/src/store/autoscaler.effects.ts - About 1 day to fix

                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 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 autoscaler-transform-metric.spec.ts has 487 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import {
                      isEqual
                    } from './autoscaler-util';
                    import {
                      insertEmptyMetrics, buildMetricData

                      Function setupCfUserRemovalTests has 189 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function setupCfUserRemovalTests(
                        cfLevel: CfUserRemovalTestLevel,
                        removalLevel: CfRolesRemovalLevel,
                        navToUserTableFn: (cfGuid: string, orgGuid: string, spaceGuid: string) => promise.Promise<any>
                      ) {
                      Severity: Major
                      Found in src/test-e2e/cloud-foundry/users-removal-e2e.helper.ts - About 7 hrs to fix

                        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

                        Function setupInviteUserTests has 181 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function setupInviteUserTests(
                          isSpace: boolean,
                          navToOrgSpaceUsersList: (cfHelper: CFHelpers, defaultCf: E2EConfigCloudFoundry) => promise.Promise<any>,
                          navToCfSummary: () => promise.Promise<any>
                        ) {
                        Severity: Major
                        Found in src/test-e2e/cloud-foundry/invite-users-e2e.helper.ts - About 7 hrs to fix

                          File entity-relations-validate.spec.ts has 464 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { inject, TestBed } from '@angular/core/testing';
                          import { Store } from '@ngrx/store';
                          import { createBasicStoreModule, createEntityStoreState, TestStoreEntity } from '@stratosui/store/testing';
                          
                          import { environment } from '../../../core/src/environments/environment';

                            File entity-relations.ts has 448 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { Action, Store } from '@ngrx/store';
                            import { denormalize } from 'normalizr';
                            import { Observable, of as observableOf } from 'rxjs';
                            import { filter, first, map, mergeMap, pairwise, skipWhile, switchMap, withLatestFrom } from 'rxjs/operators';
                            
                            

                              File specify-details-step.component.ts has 444 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import { COMMA, ENTER, SPACE } from '@angular/cdk/keycodes';
                              import { AfterContentInit, Component, Input, OnDestroy } from '@angular/core';
                              import { AbstractControl, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms';
                              import { MatChipInputEvent } from '@angular/material/chips';
                              import { Store } from '@ngrx/store';

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

                                func (p *portalProxy) DoLoginToCNSI(c echo.Context, cnsiGUID string, systemSharedToken bool) (*interfaces.LoginRes, error) {
                                
                                    cnsiRecord, err := p.GetCNSIRecord(cnsiGUID)
                                    if err != nil {
                                        return nil, interfaces.NewHTTPShadowError(
                                Severity: Minor
                                Found in src/jetstream/authcnsi.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

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

                                import { browser, by, element, Key, promise, protractor } from 'protractor';
                                import { ElementArrayFinder, ElementFinder } from 'protractor/built';
                                
                                import { Component } from './component.po';
                                import { FormComponent } from './form.po';
                                Severity: Minor
                                Found in src/test-e2e/po/list.po.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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language