cloudfoundry/stratos

View on GitHub

Showing 1,155 of 1,370 total issues

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

        Function createPodExpandedStatus has a Cognitive Complexity of 45 (exceeds 8 allowed). Consider refactoring.
        Open

          static createPodExpandedStatus(pod: KubernetesPod): KubernetesPodExpandedStatus {
        
            let restarts = 0;
            const totalContainers = pod.spec.containers ? pod.spec.containers.length : 0;
            let readyContainers = 0;

        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 main has 183 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func main() {
        
            // Register time.Time in gob
            gob.Register(time.Time{})
        
        
        Severity: Major
        Found in src/jetstream/main.go - About 6 hrs to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              it('Borked, usually due to starting timeouts', () => {
                let testData = makeTestData('STARTED', 'STAGED', ['TIMEOUT']);
                let res = cfAppStateService.get(testData.summary, testData.instances);
                expect(res.indicator).toBe('warning');
                expect($translate.instant(res.label)).toBe('Deployed');
          src/frontend/packages/cloud-foundry/src/shared/services/application-state.service.spec.ts on lines 153..168

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 315.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              it('Borked, usually due to app code', () => {
                let testData = makeTestData('STARTED', 'STAGED', ['CRASHED']);
                let res = cfAppStateService.get(testData.summary, testData.instances);
                expect(res.indicator).toBe('error');
                expect($translate.instant(res.label)).toBe('Deployed');
          src/frontend/packages/cloud-foundry/src/shared/services/application-state.service.spec.ts on lines 170..185

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 315.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function generateCFEntities has 153 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function generateCFEntities(): StratosBaseCatalogEntity[] {
            const endpointDefinition: StratosEndpointExtensionDefinition = {
              urlValidationRegexString: urlValidationExpression,
              type: CF_ENDPOINT_TYPE,
              label: 'Cloud Foundry',
          Severity: Major
          Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 6 hrs to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        staging_security_groups: [
                          {
                            metadata: {
                              guid: '40c7d0e1-c3f1-47e4-a071-586dcd9b2196',
                              url: '/v2/security_groups/40c7d0e1-c3f1-47e4-a071-586dcd9b2196',
            src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-orgs/cf-org-card/cf-org-card.component.spec.ts on lines 184..271

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 312.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        security_groups: [
                          {
                            metadata: {
                              guid: '40c7d0e1-c3f1-47e4-a071-586dcd9b2196',
                              url: '/v2/security_groups/40c7d0e1-c3f1-47e4-a071-586dcd9b2196',
            src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-orgs/cf-org-card/cf-org-card.component.spec.ts on lines 273..360

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 312.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            File list-data-source.ts has 420 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { DataSource } from '@angular/cdk/table';
            import { SortDirection } from '@angular/material/sort';
            import { Store } from '@ngrx/store';
            import {
              BehaviorSubject,

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  return this.store.select(s => [s.uaaSetup, s.auth]).pipe(
                    filter(([uaa, auth]: [UAASetupState, AuthState]) => {
                      return !(uaa.settingUp || auth.verifying);
                    }),
                    delay(2000),
              src/frontend/packages/core/src/features/setup/uaa-wizard/console-uaa-wizard.component.ts on lines 86..112

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 310.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  return this.store.select(s => [s.uaaSetup, s.auth]).pipe(
                    filter(([uaa, auth]: [UAASetupState, AuthState]) => {
                      return !(uaa.settingUp || auth.verifying);
                    }),
                    delay(2000),
              src/frontend/packages/core/src/features/setup/local-account-wizard/local-account-wizard.component.ts on lines 51..77

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 310.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              File cloud-foundry-section.routing.ts has 415 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { NgModule } from '@angular/core';
              import { RouterModule, Routes } from '@angular/router';
              
              import { DynamicExtensionRoutes } from '../../../../core/src/core/extension/dynamic-extension-routes';
              import { StratosActionType } from '../../../../core/src/core/extension/extension-service';

                File cnsi.go has 660 lines of code (exceeds 500 allowed). Consider refactoring.
                Open

                package main
                
                import (
                    "crypto/x509"
                    "encoding/json"
                Severity: Minor
                Found in src/jetstream/cnsi.go - About 5 hrs to fix

                  Method CustomBinder.bindData has a Cognitive Complexity of 41 (exceeds 8 allowed). Consider refactoring.
                  Open

                  func (b *CustomBinder) bindData(ptr interface{}, data map[string][]string, tag string) error {
                      typ := reflect.TypeOf(ptr).Elem()
                      val := reflect.ValueOf(ptr).Elem()
                  
                      if typ.Kind() != reflect.Struct {
                  Severity: Minor
                  Found in src/jetstream/custombinder/custombinder.go - About 5 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 deploy-application-deployer.ts has 405 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { Store } from '@ngrx/store';
                  import { BehaviorSubject, of as observableOf, Subject, Subscription } from 'rxjs';
                  import websocketConnect from 'rxjs-websockets';
                  import { catchError, combineLatest, filter, first, map, mergeMap, share, switchMap, tap } from 'rxjs/operators';
                  
                  

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

                    import { HttpClient } from '@angular/common/http';
                    import { Injectable } from '@angular/core';
                    import { MatSnackBar } from '@angular/material/snack-bar';
                    import { Actions, Effect, ofType } from '@ngrx/effects';
                    import { Action, Store } from '@ngrx/store';
                    Severity: Minor
                    Found in src/frontend/packages/kubernetes/src/helm/store/helm.effects.ts - About 5 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language