cloudfoundry/stratos

View on GitHub

Showing 1,155 of 1,370 total issues

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

  public start() {
    if (this.isStarted()) {
      return;
    }

    Method MetricsSpecification.getMetricsEndpoints has a Cognitive Complexity of 26 (exceeds 8 allowed). Consider refactoring.
    Open

    func (m *MetricsSpecification) getMetricsEndpoints(userGUID string, cnsiList []string) (map[string]EndpointMetricsRelation, error) {
    
        metricsProviders := make([]MetricsMetadata, 0)
        endpointsMap := make(map[string]*interfaces.ConnectedEndpoint)
        results := make(map[string]EndpointMetricsRelation)
    Severity: Minor
    Found in src/jetstream/plugins/metrics/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

    Function endpointActions has a Cognitive Complexity of 26 (exceeds 8 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)

    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 endpoint.effects.ts has 302 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { HttpClient, HttpErrorResponse, HttpParams } from '@angular/common/http';
    import { Injectable } from '@angular/core';
    import { Actions, Effect, ofType } from '@ngrx/effects';
    import { Store } from '@ngrx/store';
    import { catchError, mergeMap } from 'rxjs/operators';
    Severity: Minor
    Found in src/frontend/packages/store/src/effects/endpoint.effects.ts - About 3 hrs to fix

      ServicesHelperE2E has 27 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class ServicesHelperE2E {
      
        constructor(public e2eSetup: E2ESetup, createServiceInstance: CreateMarketplaceServiceInstance = null, seed?: ServicesHelperE2E) {
          this.cfRequestHelper = seed ? seed.cfRequestHelper : new CFRequestHelpers(e2eSetup);
          this.cfHelper = seed ? seed.cfHelper : new CFHelpers(e2eSetup);
      Severity: Minor
      Found in src/test-e2e/marketplace/services-helper-e2e.ts - About 3 hrs to fix

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

          ngOnInit() {
        
            this.canManageCredentials$ = fetchAutoscalerInfo(
              this.applicationService.cfGuid,
              this.entityServiceFactory

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

          func (c *CFPushApp) Init(appDir string, manifestPath string, overrides CFPushAppOverrides) error {
          
              // App name
              if len(overrides.Name) > 0 {
                  c.pushCommand.OptionalArgs = flag.OptionalAppName{
          Severity: Minor
          Found in src/jetstream/plugins/cfapppush/pushapp.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 PgsqlTokenRepository.findCNSIToken has a Cognitive Complexity of 25 (exceeds 8 allowed). Consider refactoring.
          Open

          func (p *PgsqlTokenRepository) findCNSIToken(cnsiGUID string, userGUID string, encryptionKey []byte, includeDisconnected bool) (interfaces.TokenRecord, error) {
              log.Debug("findCNSIToken")
              if cnsiGUID == "" {
                  msg := "Unable to find CNSI Token without a valid CNSI GUID."
                  log.Debug(msg)
          Severity: Minor
          Found in src/jetstream/repository/tokens/pgsql_tokens.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 chart-values-editor.component.ts has 294 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { HttpClient } from '@angular/common/http';
          import { AfterViewInit, Component, ElementRef, Input, OnDestroy, OnInit, Renderer2, ViewChild } from '@angular/core';
          import { JsonSchemaFormComponent } from '@cfstratos/ajsf-core';
          import * as yaml from 'js-yaml';
          import { BehaviorSubject, combineLatest, fromEvent, Observable, of, Subscription } from 'rxjs';

            Method portalProxy.DoRegisterEndpoint has 101 lines of code (exceeds 50 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: Major
            Found in src/jetstream/cnsi.go - About 3 hrs to fix

              Function setupCfUserTableTests has 76 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function setupCfUserTableTests(
                cfLevel: CfUserTableTestLevel,
                navToUserTableFn: (cfGuid: string, orgGuid: string, spaceGuid: string) => promise.Promise<any>
              ) {
              
              
              Severity: Major
              Found in src/test-e2e/cloud-foundry/users-list-e2e.helper.ts - About 3 hrs to fix

                portalProxy has 26 methods (exceeds 20 allowed). Consider refactoring.
                Open

                func (p *portalProxy) RegisterEndpoint(c echo.Context, fetchInfo interfaces.InfoFunc) error {
                    log.Debug("registerEndpoint")
                
                    params := new(interfaces.RegisterEndpointParams)
                    err := interfaces.BindOnce(params, c)
                Severity: Minor
                Found in src/jetstream/cnsi.go - About 3 hrs to fix

                  Function fill has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    fill(fields: { [fieldKey: string]: string | boolean | number[] }, expectFailure = false): promise.Promise<void> {
                      return this.getControlsMapFormFill().then(ctrls => {
                        Object.keys(fields).forEach(field => {
                          const ctrl = ctrls[field] as FormItem;
                          const value: any = fields[field];
                  Severity: Major
                  Found in src/test-e2e/po/form.po.ts - About 3 hrs to fix

                    AppAutoscalerComboChartComponent has 26 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    @Component({
                      selector: 'app-autoscaler-combo-chart-component',
                      templateUrl: './combo-chart.component.html',
                      styleUrls: ['./combo-chart.component.scss'],
                      encapsulation: ViewEncapsulation.None

                      Function setProps has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        setProps(props: KubernetesResourceViewerConfig) {
                          this.title = props.title;
                          this.analysis = props.analysis;
                          this.component = props.component;
                      
                      

                        Method portalProxy.registerRoutes has 99 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (p *portalProxy) registerRoutes(e *echo.Echo, needSetupMiddleware bool) {
                            log.Debug("registerRoutes")
                        
                            e.GET("/swagger/*", echoSwagger.WrapHandler)
                        
                        
                        Severity: Major
                        Found in src/jetstream/main.go - About 2 hrs to fix

                          Method portalProxy.DoLoginToCNSI has 99 lines of code (exceeds 50 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: Major
                          Found in src/jetstream/authcnsi.go - About 2 hrs to fix

                            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

                              Function bars has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  this.bars = this.series.map((d, index) => {
                              
                                    let value = d.value;
                                    const label = d.name;
                                    const formattedLabel = formatLabel(label);

                                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

                                Severity
                                Category
                                Status
                                Source
                                Language