cloudfoundry/stratos

View on GitHub

Showing 718 of 1,370 total issues

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

                        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

                        File application-delete.component.ts has 288 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { DatePipe } from '@angular/common';
                        import { Component } from '@angular/core';
                        import { Store } from '@ngrx/store';
                        import { combineLatest, Observable, ReplaySubject } from 'rxjs';
                        import { filter, first, map, pairwise, shareReplay, startWith, switchMap, tap } from 'rxjs/operators';

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

                          import { HttpParams, HttpRequest } from '@angular/common/http';
                          
                          import { getActions } from '../../../store/src/actions/action.helper';
                          import { PaginatedAction } from '../../../store/src/types/pagination.types';
                          import { ICFAction } from '../../../store/src/types/request.types';
                          Severity: Minor
                          Found in src/frontend/packages/cloud-foundry/src/actions/space.actions.ts - About 2 hrs to fix

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

                              @Input('row')
                              set row(row: APIResource<IServiceInstance>) {
                                super.row = row;
                                if (row) {
                                  this.serviceInstanceEntity = row;

                              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(
                                    public applicationService: ApplicationService,
                                    private store: Store<CFAppState>,
                                    private endpointsService: EndpointsService,
                                    private ngZone: NgZone,
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language