cloudfoundry/stratos

View on GitHub

Showing 718 of 1,370 total issues

ChartValuesEditorComponent has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

@Component({
  selector: 'app-chart-values-editor',
  templateUrl: './chart-values-editor.component.html',
  styleUrls: ['./chart-values-editor.component.scss']
})

    ListComponent has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    @Component({
      selector: 'app-list',
      templateUrl: './list.component.html',
      styleUrls: ['./list.component.scss'],
      animations: [

      KubernetesEffects has 24 functions (exceeds 20 allowed). Consider refactoring.
      Open

      @Injectable()
      export class KubernetesEffects {
        proxyAPIVersion = environment.proxyAPIVersion;
      
        constructor(private http: HttpClient, private actions$: Actions, private store: Store<AppState>) { }

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

          ngOnInit() {
            const coreInfo$: Observable<[EnvVarStratosProject, GitMeta]> = this.appService.applicationStratProject$.pipe(
              first(),
              map(stProject => [stProject, this.createBaseGitMeta(stProject)])
            );

          File kube-config-import.component.ts has 276 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { Component, ComponentFactoryResolver, Injector, OnDestroy } from '@angular/core';
          import { FormBuilder } from '@angular/forms';
          import { Store } from '@ngrx/store';
          import { BehaviorSubject, Observable, of as observableOf, Subscription } from 'rxjs';
          import { distinctUntilChanged, filter, first, map, pairwise, startWith, withLatestFrom } from 'rxjs/operators';

            Function generateHelmEntities has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function generateHelmEntities(): StratosBaseCatalogEntity[] {
              const helmRepoRenderPriority = 10;
              const endpointDefinition: StratosEndpointExtensionDefinition = {
                type: HELM_ENDPOINT_TYPE,
                logoUrl: '/core/assets/custom/helm.svg',
            Severity: Major
            Found in src/frontend/packages/kubernetes/src/helm/helm-entity-generator.ts - About 2 hrs to fix

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

                constructor(public helmReleaseHelper: HelmReleaseHelperService) {
              
                  // Use the ame column layout as the Helm CLI
                  this.columns = [
                    {

                Method CFAppSSH.appSSH has a Cognitive Complexity of 22 (exceeds 8 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: Minor
                Found in src/jetstream/plugins/cfappssh/app_ssh.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

                File home-page.component.ts has 274 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { ScrollDispatcher } from '@angular/cdk/scrolling';
                import {
                  AfterViewInit,
                  Component,
                  ElementRef,

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

                    Function onPrepare has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      onPrepare() {
                        // https://webdriver.io/docs/api/chromium.html#setnetworkconditions
                        // browser.driver.setNetworkConditions({
                        //   offline: false,
                        //   latency: 2000, // Additional latency (ms).
                    Severity: Major
                    Found in protractor.conf.js - About 2 hrs to fix

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

                        ngOnInit() {
                          const guid = this.kubeEndpointService.baseKube.guid;
                      
                          const podsObs = kubeEntityCatalog.pod.store.getPaginationService(guid);
                          const pods$ = podsObs.entities$;

                        File helm-release-helper.service.ts has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { Injectable } from '@angular/core';
                        import { combineLatest, Observable } from 'rxjs';
                        import { filter, map } from 'rxjs/operators';
                        
                        import { helmEntityCatalog } from '../../../../helm/helm-entity-catalog';

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

                          import { browser, by, element, promise } from 'protractor';
                          import { ElementArrayFinder, ElementFinder, protractor } from 'protractor/built';
                          import { Key } from 'selenium-webdriver';
                          
                          import { Component } from './component.po';
                          Severity: Minor
                          Found in src/test-e2e/po/form.po.ts - About 2 hrs to fix

                            Function authReducer has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function authReducer(state: AuthState = defaultState, action): AuthState {
                              switch (action.type) {
                                case LOGIN:
                                  return { ...state, loggingIn: true, loggedIn: false, error: false };
                                case LOGIN_SUCCESS:
                            Severity: Major
                            Found in src/frontend/packages/store/src/reducers/auth.reducer.ts - About 2 hrs to fix

                              Function parseAuth has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                public parseAuth(cluster: KubeConfigFileCluster, user: KubeConfigFileUser): RowState {
                              
                                  // Default subtype is generic Kubernetes ('') or previously determined/selected sub type
                                  cluster._subType = cluster._subType || '';
                              
                              

                                Function extractArchiveFiles has a Cognitive Complexity of 21 (exceeds 8 allowed). Consider refactoring.
                                Open

                                func extractArchiveFiles(archivePath, chartName, downloadFolder string, filenames []string) error {
                                    // Map the filenames array into a map of path to destination file
                                    requiredFiles := make(map[string]string)
                                    requiredCount := len(filenames)
                                    for _, name := range filenames {
                                Severity: Minor
                                Found in src/jetstream/plugins/monocular/cache.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 PgsqlTokenRepository.SaveCNSIToken has a Cognitive Complexity of 21 (exceeds 8 allowed). Consider refactoring.
                                Open

                                func (p *PgsqlTokenRepository) SaveCNSIToken(cnsiGUID string, userGUID string, tr interfaces.TokenRecord, encryptionKey []byte) error {
                                    log.Debug("SaveCNSIToken")
                                    if cnsiGUID == "" {
                                        msg := "Unable to save CNSI Token without a valid CNSI GUID."
                                        log.Debug(msg)
                                Severity: Minor
                                Found in src/jetstream/repository/tokens/pgsql_tokens.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 CloudFoundrySpecification.cfLoginHook has a Cognitive Complexity of 21 (exceeds 8 allowed). Consider refactoring.
                                Open

                                func (c *CloudFoundrySpecification) cfLoginHook(context echo.Context) error {
                                
                                    cfAPI, cfCnsi, err := c.fetchAutoRegisterEndpoint()
                                    // CF auto reg url missing, continue as normal
                                    if cfAPI == "" {
                                Severity: Minor
                                Found in src/jetstream/plugins/cloudfoundry/main.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 validate has a Cognitive Complexity of 21 (exceeds 8 allowed). Consider refactoring.
                                Open

                                  private validate(endpoints: EndpointModel[], cluster: KubeConfigFileCluster, clusters: KubeConfigFileCluster[]) {
                                    cluster._invalid = false;
                                    let reset = true;
                                
                                    const found = endpoints.find(item => item.name === cluster.name);

                                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