cloudfoundry-incubator/stratos

View on GitHub

Showing 1,111 of 1,370 total issues

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

        endpoints: {
          cf: {
            '0e934dc8-7ad4-40ff-b85c-53c1b61d2abb': {
              global: {
                isAdmin: false,
src/frontend/packages/core/src/core/permissions/current-user-permissions.service.spec.ts on lines 170..446

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

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

        endpoints: {
          cf: {
            '0e934dc8-7ad4-40ff-b85c-53c1b61d2abb': {
              global: {
                isAdmin: false,
src/frontend/packages/cloud-foundry/src/shared/services/current-user-permissions-and-cfchecker.service.spec.ts on lines 634..910

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

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

  function createStoreState(): Partial<AppState<BaseEntityValues>> {
    // Data
    const endpoints: EndpointModel[] = [
      {
        guid: '0e934dc8-7ad4-40ff-b85c-53c1b61d2abb',

    File current-user-permissions-and-cfchecker.service.spec.ts has 1026 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { TestBed } from '@angular/core/testing';
    import { createBasicStoreModule, createEntityStoreState, TestStoreEntity } from '@stratosui/store/testing';
    import { first, tap } from 'rxjs/operators';
    
    import { PermissionConfig } from '../../../../core/src/core/permissions/current-user-permissions.config';

      Function createStoreState has 427 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function createStoreState(): Partial<AppState<BaseEntityValues>> {
          // Data
          const endpoints: EndpointModel[] = [
            {
              guid: '0e934dc8-7ad4-40ff-b85c-53c1b61d2abb',

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

              it('Usernames Step', () => {
                stepper.waitForStep('Usernames');
        
                const usernamesStep = manageUsersStepper.setUsernames;
                const addRemove = usernamesStep.addRemoveRadio;
        src/test-e2e/cloud-foundry/manage-users-by-username-stepper-e2e.spec.ts on lines 376..402

        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

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

              it('Usernames Step', () => {
                stepper.waitForStep('Usernames');
        
                const usernamesStep = manageUsersStepper.setUsernames;
                const addRemove = usernamesStep.addRemoveRadio;
        src/test-e2e/cloud-foundry/manage-users-by-username-stepper-e2e.spec.ts on lines 155..181

        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

            return uaaHelpers.setup()
              .then(() => e2e.log(`Creating User: ${userName}`))
              .then(() => uaaHelpers.createUser(userName))
              .then(newUser => {
                uaaUserGuid = newUser.id;
        src/test-e2e/cloud-foundry/users-removal-e2e.helper.ts on lines 59..95

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

        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 uaaHelpers.setup()
              .then(() => e2e.log(`Creating User: ${userName}`))
              .then(() => uaaHelpers.createUser(userName))
              .then(newUser => {
                uaaUserGuid = newUser.id;
        Severity: Major
        Found in src/test-e2e/cloud-foundry/users-removal-e2e.helper.ts and 1 other location - About 1 day to fix
        src/test-e2e/cloud-foundry/manage-users-by-username-stepper-e2e.spec.ts on lines 50..86

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

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

        import { animate, style, transition, trigger } from '@angular/animations';
        import {
          AfterViewInit,
          ChangeDetectorRef,
          Component,

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

            constructor() {
              const endpointDef: StratosEndpointExtensionDefinition = {
                type: KUBERNETES_ENDPOINT_TYPE,
                label: 'Kubernetes',
                labelPlural: 'Kubernetes',

            File main.go has 891 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            package main
            
            import (
                "crypto/sha1"
                "crypto/tls"
            Severity: Major
            Found in src/jetstream/main.go - About 1 day to fix

              File kubernetes-entity-generator.ts has 599 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { Compiler, Injector } from '@angular/core';
              import { Validators } from '@angular/forms';
              import moment from 'moment';
              
              import { BaseEndpointAuth } from '../../../core/src/core/endpoint-auth';

                Function initialise has 255 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Method KubeTerminal.cleanup has a Cognitive Complexity of 58 (exceeds 8 allowed). Consider refactoring.
                  Open

                  func (k *KubeTerminal) cleanup() {
                      // Use a random initial wait before cleaning up
                      // If we had more than one backend, this helps to ensure they are not all trying to cleanup at the same time
                      wait := rand.Intn(30)
                      log.Debug("Kubernetes Terminal cleanup will start in %d minutes", wait)
                  Severity: Minor
                  Found in src/jetstream/plugins/kubernetes/terminal/cleanup.go - About 1 day 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 application-autoscaler-e2e.spec.ts has 503 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import moment from 'moment-timezone';
                  import { browser, promise } from 'protractor';
                  import { timer } from 'rxjs';
                  import { switchMap } from 'rxjs/operators';
                  
                  
                  Severity: Major
                  Found in src/test-e2e/application/application-autoscaler-e2e.spec.ts - About 1 day to fix

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

                    import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
                    import { Injectable } from '@angular/core';
                    import { Actions, Effect, ofType } from '@ngrx/effects';
                    import { Action, Store } from '@ngrx/store';
                    import { ClearPaginationOfEntity, ClearPaginationOfType } from 'frontend/packages/store/src/actions/pagination.actions';

                      File kube.types.ts has 499 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { Observable } from 'rxjs';
                      
                      import {
                        OrchestratedActionBuilderConfig,
                        OrchestratedActionBuilders,
                      Severity: Minor
                      Found in src/frontend/packages/kubernetes/src/kubernetes/store/kube.types.ts - About 1 day to fix

                        File current-user-permissions.service.spec.ts has 497 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { TestBed } from '@angular/core/testing';
                        import { createBasicStoreModule, createEntityStoreState, TestStoreEntity } from '@stratosui/store/testing';
                        import { first, tap } from 'rxjs/operators';
                        
                        import { AppState } from '../../../../store/src/app-state';

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

                              it('Borked, usually due to platform issues (2)', () => {
                                let testData = makeTestData('STARTED', 'STAGED', ['RUNNING', 'UNKNOWN']);
                                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 204..220

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

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language