cloudfoundry-incubator/stratos

View on GitHub

Showing 650 of 1,370 total issues

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 entity-catalog-entity.ts has 298 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { ActionReducer } from '@ngrx/store';
    
    import { IRequestEntityTypeState } from '../../app-state';
    import {
      EntitiesFetchHandler,

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

        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

            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

                Function cfUsersRolesReducer has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function cfUsersRolesReducer(state: UsersRolesState = defaultState, action: Action): UsersRolesState {
                  switch (action.type) {
                    case UsersRolesActions.SetUsers:
                      const setUsersAction = action as UsersRolesSetUsers;
                      const orgGuid = state.newRoles ? state.newRoles.orgGuid : '';

                  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

                    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

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

                    func (p *portalProxy) xsrfMiddlewareWithConfig(config MiddlewareConfig) echo.MiddlewareFunc {
                        // Default skipper function always returns false
                        if config.Skipper == nil {
                            config.Skipper = func(c echo.Context) bool { return false }
                        }
                    Severity: Minor
                    Found in src/jetstream/middleware.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 setupForGit has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring.
                    Open

                      private setupForGit() {
                        this.projectInfo$ = this.store.select(selectProjectExists).pipe(
                          filter(p => !!p),
                          map(p => (!!p.exists && !!p.data) ? p.data : null),
                          tap(p => {

                    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

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

                        function setupOrgLevelTest(selectAddRemove: (rb: RadioGroup) => void, checkInitialState: () => void, checkFinishingState: () => void) {
                          it('Check initial state and get to stepper', () => {
                            checkInitialState();
                    
                            orgPage.subHeader.hasIconButton('people');

                      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(
                            private componentFactoryResolver: ComponentFactoryResolver,
                            public helmReleaseHelper: HelmReleaseHelperService,
                            private store: Store<AppState>,
                            private confirmDialog: ConfirmationDialogService,
                          Severity
                          Category
                          Status
                          Source
                          Language