cloudfoundry/stratos

View on GitHub

Showing 718 of 1,370 total issues

File cf-user-list-config.service.ts has 324 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { BehaviorSubject, combineLatest, Observable, of as observableOf } from 'rxjs';
import { filter, first, map, switchMap, tap } from 'rxjs/operators';

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

    func (ch *CFHosting) Init() error {
    
        // Determine if we are running CF by presence of env var "VCAP_APPLICATION" and configure appropriately
        if ch.portalProxy.Env().IsSet(VCapApplication) {
            log.Info("Detected that Console is deployed as a Cloud Foundry Application")
    Severity: Minor
    Found in src/jetstream/plugins/cloudfoundryhosting/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

    File application-wall-e2e.spec.ts has 320 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { browser, promise } from 'protractor';
    
    import { IOrganization, ISpace } from '../../frontend/packages/cloud-foundry/src/cf-api.types';
    import { APIResource } from '../../frontend/packages/store/src/types/api.types';
    import { ApplicationE2eHelper } from '../application/application-e2e-helpers';
    Severity: Minor
    Found in src/test-e2e/applications/application-wall-e2e.spec.ts - About 3 hrs to fix

      File specify-user-provided-details.component.ts has 319 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { COMMA, ENTER, SPACE } from '@angular/cdk/keycodes';
      import { HttpHeaders, HttpParams, HttpRequest } from '@angular/common/http';
      import { Component, Input, OnDestroy } from '@angular/core';
      import { FormControl, FormGroup, Validators } from '@angular/forms';
      import { MatChipInputEvent } from '@angular/material/chips';

        Method Analyzer.doRun has a Cognitive Complexity of 28 (exceeds 8 allowed). Consider refactoring.
        Open

        func (a *Analyzer) doRun(ec echo.Context) error {
        
            log.Debug("Run analyzer!")
        
            engine := ec.Param("analyzer")
        Severity: Minor
        Found in src/jetstream/plugins/analysis/container/run.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 ngOnInit has a Cognitive Complexity of 28 (exceeds 8 allowed). Consider refactoring.
        Open

          ngOnInit() {
            this.hasFavEntities = this.userFavoriteManager.endpointHasEntitiesThatCanFavorite(this.endpoint.cnsi_type);
            // Favorites for this endpoint
            this.favorites$ = this.userFavoriteManager.getFavoritesForEndpoint(this.endpoint.guid);
            this.entity = entityCatalog.getEndpoint(this.endpoint.cnsi_type, this.endpoint.sub_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 deploy.go has 562 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        package cfapppush
        
        import (
            "encoding/base64"
            "encoding/json"
        Severity: Minor
        Found in src/jetstream/plugins/cfapppush/deploy.go - About 3 hrs to fix

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

            constructor(
              ext: ExtensionService,
              private store: Store<GeneralEntityAppState>,
              eventService: GlobalEventService,
              private userFavoriteManager: UserFavoriteManager,
          Severity: Major
          Found in src/frontend/packages/core/src/app.module.ts - About 3 hrs to fix

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

            import { EntitySchema } from '../../store/src/helpers/entity-schema';
            import { metricEntityType } from '../../store/src/helpers/stratos-entity-factory';
            import { APIResource } from '../../store/src/types/api.types';
            import {
              CFApplicationEntitySchema,
            Severity: Minor
            Found in src/frontend/packages/cloud-foundry/src/cf-entity-factory.ts - About 3 hrs to fix

              File deploy-application-step2.component.ts has 310 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { HttpClient } from '@angular/common/http';
              import { AfterContentInit, Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core';
              import { NgForm } from '@angular/forms';
              import { ActivatedRoute } from '@angular/router';
              import { Store } from '@ngrx/store';

                Function hash has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  public static hash( string: any ) : string
                  {
                      let temp: string;
                
                      if ( typeof string !== 'string' )
                Severity: Major
                Found in src/frontend/packages/core/src/shared/components/user-avatar/md5.ts - About 3 hrs to fix

                  Function InstallDashboard has a Cognitive Complexity of 27 (exceeds 8 allowed). Consider refactoring.
                  Open

                  func InstallDashboard(p interfaces.PortalProxy, endpointGUID, userGUID string) error {
                      // Download the Yaml for the dashboard
                      kubeDashboardImage := p.Env().String("STRATOS_KUBERNETES_DASHBOARD_IMAGE", "")
                      if len(kubeDashboardImage) == 0 {
                          kubeDashboardImage = dashboardInstallYAMLDownloadURL
                  Severity: Minor
                  Found in src/jetstream/plugins/kubernetes/dashboard/configure.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 update has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    update(): void {
                      let width;
                      if (this.series.length) {
                        width = this.xScale.bandwidth();
                        this.bandwidth.emit(width);

                    ListDataSource has 28 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    export abstract class ListDataSource<T, A = T> extends DataSource<T> implements IListDataSource<T> {
                    
                      // -------------- Public
                      // Core observables
                      public pagination$: Observable<PaginationEntityState>;

                      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
                              Severity
                              Category
                              Status
                              Source
                              Language