SUSE/stratos

View on GitHub

Showing 1,395 of 1,395 total issues

Method CFAppSSH.appSSH has 94 lines of code (exceeds 50 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: Major
Found in src/jetstream/plugins/cfappssh/app_ssh.go - About 2 hrs to fix

    Method HelmReleaseGraph.ProcessPod has a Cognitive Complexity of 23 (exceeds 8 allowed). Consider refactoring.
    Open

    func (r *HelmReleaseGraph) ProcessPod(id string, res KubeResource, spec v1.PodSpec, status v1.PodStatus) {
        // Look through volumes
        // name and: PersistentVolumeClaim.ClaimName or Secret.SecretName
        for _, volume := range spec.Volumes {
            if volume.VolumeSource.PersistentVolumeClaim != nil {
    Severity: Minor
    Found in src/jetstream/plugins/kubernetes/helm/graph.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 findDatabaseConfig has a Cognitive Complexity of 23 (exceeds 8 allowed). Consider refactoring.
    Open

    func findDatabaseConfig(vcapServices map[string][]VCAPService, db *DatabaseConfig, env *env.VarSet) bool {
        var service VCAPService
        configs := findDatabaseConfigurations(vcapServices)
        log.Infof("Found %d database service instances", len(configs))
        for _, s := range configs {
    Severity: Minor
    Found in src/jetstream/datastore/database_cf_config.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 update has a Cognitive Complexity of 23 (exceeds 8 allowed). Consider refactoring.
    Open

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

    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 processObject has a Cognitive Complexity of 23 (exceeds 8 allowed). Consider refactoring.
    Open

    function processObject(object: any, output?: any, nested?: boolean) {
      if (nested && output) {
        output = { properties: output };
      } else {
        output = output || {};

    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 dashboardReducer has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function dashboardReducer(state: DashboardState = defaultDashboardState, action): DashboardState {
      switch (action.type) {
        case OPEN_SIDE_NAV:
          if (state.isMobile) {
            return { ...state, isMobileNavOpen: true };
    Severity: Major
    Found in src/frontend/packages/store/src/reducers/dashboard-reducer.ts - About 2 hrs to fix

      File application-state.service.ts has 279 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { Injectable } from '@angular/core';
      
      import { StratosStatus, StratosStatusMetadata } from '../../../../store/src/types/shared.types';
      import { AppStat } from '../../store/types/app-metadata.types';
      
      

        File manage-users-modify.component.ts has 279 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import {
          ChangeDetectorRef,
          Component,
          ComponentFactory,
          ComponentFactoryResolver,

          Function exports has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function (project) {
            var path = require('path')
            var repoRoot = path.join(__dirname, '..')
            return function (config) {
          
          
          Severity: Major
          Found in build/karma.conf.creator.js - About 2 hrs to fix

            Function populatePaginationFromParent has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function populatePaginationFromParent(store: Store<GeneralEntityAppState>, action: PaginatedAction): Observable<Action> {
              const eicAction = isEntityInlineChildAction(action);
              if (!eicAction || !action.flattenPagination) {
                return observableOf(action);
              }

              Function open has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                open() {
                  if (this.isOpen) {
                    return;
                  }
              
              

                Function initialiseSpaceObservables has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private initialiseSpaceObservables() {
                    this.space$ = this.cfUserService.isConnectedUserAdmin(this.cfGuid).pipe(
                      switchMap(isAdmin => {
                        const relations = [
                          createEntityRelationKey(spaceEntityType, spaceQuotaEntityType),

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

                    constructor(
                      private config: IListDataSourceConfig<A, T>,
                    ) {
                      super();
                      this.init(config);

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

                    export class E2EHelpers {
                    
                      static e2eItemPrefix = 'acceptance.e2e.';
                      static customOrgSpaceLabel = E2EHelpers.e2eItemPrefix + (process.env.CUSTOM_ORG_SPACE_LABEL || process.env.USER);
                    
                    
                    Severity: Minor
                    Found in src/test-e2e/helpers/e2e-helpers.ts - About 2 hrs to fix

                      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>) { }

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

                            func (a *localAuth) generateLoginSuccessResponse(c echo.Context, userGUID string, username string) error {
                                log.Debug("generateLoginResponse")
                            
                                var err error
                                var expiry int64
                            Severity: Major
                            Found in src/jetstream/authlocal.go and 1 other location - About 2 hrs to fix
                            src/jetstream/authnone.go on lines 95..133

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

                            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

                            func (a *noAuth) generateLoginSuccessResponse(c echo.Context, userGUID string, username string) error {
                                log.Debug("generateLoginResponse")
                            
                                var err error
                                var expiry int64
                            Severity: Major
                            Found in src/jetstream/authnone.go and 1 other location - About 2 hrs to fix
                            src/jetstream/authlocal.go on lines 189..227

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

                            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

                            Method portalProxy.registerRoutes has 91 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
                              Severity
                              Category
                              Status
                              Source
                              Language