SUSE/stratos

View on GitHub

Showing 1,395 of 1,395 total issues

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

export class PageAutoscalerEventBase extends Page {

  list: ListComponent;

  constructor(public cfGuid: string, public appGuid: string) {
Severity: Major
Found in src/test-e2e/application/po/page-autoscaler-event-base.po.ts and 1 other location - About 3 hrs to fix
src/test-e2e/application/po/page-autoscaler-metric-base.po.ts on lines 6..29

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

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

export class PageAutoscalerMetricBase extends Page {

  list: ListComponent;

  constructor(public cfGuid: string, public appGuid: string) {
src/test-e2e/application/po/page-autoscaler-event-base.po.ts on lines 6..29

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

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

CfUserPermissionsChecker has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

export class CfUserPermissionsChecker extends BaseCurrentUserPermissionsChecker implements ICurrentUserPermissionsChecker {
  static readonly ALL_SPACES = 'PERMISSIONS__ALL_SPACES_PLEASE';

  constructor(private store: Store<GeneralEntityAppState>) {
    super();

    ListDataSource has 28 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export abstract class ListDataSource<T, A = T> extends DataSource<T> implements IListDataSource<T> {
    
      // -------------- Public
      // Core observables
      public pagination$: Observable<PaginationEntityState>;

      Function getDefaultInitialTestStratosStoreState has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getDefaultInitialTestStratosStoreState() {
        return {
          recentlyVisited: {},
          userFavoritesGroups: {
            busy: false,
      Severity: Major
      Found in src/frontend/packages/store/testing/src/store-test-helper.ts - About 3 hrs to fix

        Function start has 82 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public start() {
            if (this.isStarted()) {
              return;
            }
        
        

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

          import { HttpClient, HttpErrorResponse, HttpParams } from '@angular/common/http';
          import { Injectable } from '@angular/core';
          import { Actions, Effect, ofType } from '@ngrx/effects';
          import { Store } from '@ngrx/store';
          import { catchError, mergeMap } from 'rxjs/operators';
          Severity: Minor
          Found in src/frontend/packages/store/src/effects/endpoint.effects.ts - About 3 hrs to fix

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

            var PolymorphicSchema = /*#__PURE__*/function () {
              function PolymorphicSchema(definition, schemaAttribute) {
                if (schemaAttribute) {
                  this._schemaAttribute = typeof schemaAttribute === 'string' ? function (input) {
                    return input[schemaAttribute];
            Severity: Minor
            Found in src/frontend/packages/store/src/normalizr/normalizr.js - 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

            ServicesHelperE2E has 27 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export class ServicesHelperE2E {
            
              constructor(public e2eSetup: E2ESetup, createServiceInstance: CreateMarketplaceServiceInstance = null, seed?: ServicesHelperE2E) {
                this.cfRequestHelper = seed ? seed.cfRequestHelper : new CFRequestHelpers(e2eSetup);
                this.cfHelper = seed ? seed.cfHelper : new CFHelpers(e2eSetup);
            Severity: Minor
            Found in src/test-e2e/marketplace/services-helper-e2e.ts - About 3 hrs to fix

              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,

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

                  @Effect()
                  detachAppAutoscalerPolicy$ = this.actions$.pipe(
                    ofType<DetachAppAutoscalerPolicyAction>(DETACH_APP_AUTOSCALER_POLICY),
                    mergeMap(action => {
                      const actionType = 'delete';
                src/frontend/packages/cf-autoscaler/src/store/autoscaler.effects.ts on lines 245..269

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

                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

                  @Effect()
                  deleteAppAutoscalerCredential$ = this.actions$.pipe(
                    ofType<DeleteAppAutoscalerCredentialAction>(DELETE_APP_AUTOSCALER_CREDENTIAL),
                    mergeMap(action => {
                      const actionType = 'delete';
                src/frontend/packages/cf-autoscaler/src/store/autoscaler.effects.ts on lines 184..208

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

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

                  ngOnInit() {
                
                    this.canManageCredentials$ = fetchAutoscalerInfo(
                      this.applicationService.cfGuid,
                      this.entityServiceFactory

                  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

                  Function EntitySchema has a Cognitive Complexity of 25 (exceeds 8 allowed). Consider refactoring.
                  Open

                  var EntitySchema = /*#__PURE__*/function () {
                    function EntitySchema(key, definition, options) {
                      if (definition === void 0) {
                        definition = {};
                      }
                  Severity: Minor
                  Found in src/frontend/packages/store/src/normalizr/normalizr.js - 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';

                    Function setupCfUserTableTests has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function setupCfUserTableTests(
                      cfLevel: CfUserTableTestLevel,
                      navToUserTableFn: (cfGuid: string, orgGuid: string, spaceGuid: string) => promise.Promise<any>
                    ) {
                    
                    
                    Severity: Major
                    Found in src/test-e2e/cloud-foundry/users-list-e2e.helper.ts - 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
                        Severity
                        Category
                        Status
                        Source
                        Language