cloudfoundry-incubator/stratos

View on GitHub

Showing 650 of 1,370 total issues

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

    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,

      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 store-test-helper.ts has 415 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { ModuleWithProviders } from '@angular/core';
        import { TestBed } from '@angular/core/testing';
        import { Store, StoreModule, StoreRootModule } from '@ngrx/store';
        import {
          appReducers,
        Severity: Minor
        Found in src/frontend/packages/store/testing/src/store-test-helper.ts - About 5 hrs to fix

          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

            File manage-users-by-username-stepper-e2e.spec.ts has 407 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { browser, by, element, promise } from 'protractor';
            
            import { CfUser } from '../../frontend/packages/cloud-foundry/src/store/types/cf-user.types';
            import { APIResource } from '../../frontend/packages/store/src/types/api.types';
            import { e2e } from '../e2e';

              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 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

                Function initialise has a Cognitive Complexity of 38 (exceeds 8 allowed). Consider refactoring.
                Open

                  private initialise() {
                    this.globalActions = this.setupActionsDefaultObservables(
                      this.config.getGlobalActions()
                    );
                    this.multiActions = this.setupActionsDefaultObservables(

                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 cf.helpers.ts has 380 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { ActivatedRoute } from '@angular/router';
                import { Store } from '@ngrx/store';
                import { combineLatest, Observable } from 'rxjs';
                import { filter, first, map, publishReplay, refCount, switchMap, tap } from 'rxjs/operators';
                
                
                Severity: Minor
                Found in src/frontend/packages/cloud-foundry/src/features/cf/cf.helpers.ts - About 5 hrs to fix

                  Function main has a Cognitive Complexity of 37 (exceeds 8 allowed). Consider refactoring.
                  Open

                  func main() {
                  
                      // Register time.Time in gob
                      gob.Register(time.Time{})
                  
                  
                  Severity: Minor
                  Found in src/jetstream/main.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

                  Method portalProxy.ProxyRequest has a Cognitive Complexity of 37 (exceeds 8 allowed). Consider refactoring.
                  Open

                  func (p *portalProxy) ProxyRequest(c echo.Context, uri *url.URL) (map[string]*interfaces.CNSIRequest, error) {
                      log.Debug("ProxyRequest")
                      cnsiList := strings.Split(c.Request().Header.Get("x-cap-cnsi-list"), ",")
                      shouldPassthrough := "true" == c.Request().Header.Get("x-cap-passthrough")
                      longRunning := "true" == c.Request().Header.Get(longRunningTimeoutHeader)
                  Severity: Minor
                  Found in src/jetstream/passthrough.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

                  Function getDefaultInitialTestStoreState has 127 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function getDefaultInitialTestStoreState(): AppState<BaseEntityValues> {
                    return {
                      ...getDefaultInitialTestStratosStoreState(),
                      pagination: {
                        system: {},
                  Severity: Major
                  Found in src/frontend/packages/store/testing/src/store-test-helper.ts - About 5 hrs to fix

                    File entity-service.spec.ts has 375 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { HttpClientModule, HttpRequest, HttpXhrBackend } from '@angular/common/http';
                    import { HttpTestingController } from '@angular/common/http/testing';
                    import { inject, TestBed } from '@angular/core/testing';
                    import { Action, Store } from '@ngrx/store';
                    import { filter, first, map, pairwise, tap } from 'rxjs/operators';
                    Severity: Minor
                    Found in src/frontend/packages/store/src/entity-service.spec.ts - About 5 hrs to fix

                      File cf-shared.module.ts has 365 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { CommonModule } from '@angular/common';
                      import { ApplicationModule, NgModule, Type } from '@angular/core';
                      import { MaterialDesignFrameworkModule } from '@cfstratos/ajsf-material';
                      
                      import { CoreModule } from '../../../core/src/core/core.module';
                      Severity: Minor
                      Found in src/frontend/packages/cloud-foundry/src/shared/cf-shared.module.ts - About 4 hrs to fix

                        Method portalProxy.buildCNSIList has a Cognitive Complexity of 35 (exceeds 8 allowed). Consider refactoring.
                        Open

                        func (p *portalProxy) buildCNSIList(c echo.Context) ([]*interfaces.CNSIRecord, error) {
                            log.Debug("buildCNSIList")
                        
                            if p.GetConfig().UserEndpointsEnabled != config.UserEndpointsConfigEnum.Disabled {
                                userID, err := p.GetSessionValue(c, "user_id")
                        Severity: Minor
                        Found in src/jetstream/cnsi.go - About 4 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 schema-tree-traverse.spec.ts has 357 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { RecursiveDelete } from '../effects/recursive-entity-delete.effect';
                        import { EntitySchema } from './entity-schema';
                        import { EntitySchemaTreeBuilder, IFlatTreeValue } from './schema-tree-traverse';
                        
                        describe('SchemaTreeTraversal', () => {
                        Severity: Minor
                        Found in src/frontend/packages/store/src/helpers/schema-tree-traverse.spec.ts - About 4 hrs to fix

                          File cf-api.types.ts has 353 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { APIResource } from '../../store/src/types/api.types';
                          import { IService, IServiceBinding } from './cf-api-svc.types';
                          import { CfUser } from './store/types/cf-user.types';
                          
                          export interface StratosCFEntity {
                          Severity: Minor
                          Found in src/frontend/packages/cloud-foundry/src/cf-api.types.ts - About 4 hrs to fix

                            Function StratosSpecReporter has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              var StratosSpecReporter = function (baseReporterDecorator, config) {
                                baseReporterDecorator(this);
                            
                                const reporterConfig = Object.assign({}, config.stratosReporter);
                                this.file = reporterConfig.reportFile || './stratos-test-report.log';
                            Severity: Major
                            Found in build/karma.test.reporter.js - About 4 hrs to fix

                              Function createPodExpandedStatus has 106 lines of code (exceeds 25 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;
                                Severity
                                Category
                                Status
                                Source
                                Language