SUSE/stratos

View on GitHub

Showing 1,395 of 1,395 total issues

Function constructor has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring.
Open

  constructor(
    store: Store<CFAppState>,
    listConfig: IListConfig<APIResource>,
    cfGuid: string,
    action: PaginatedAction,

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

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

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

  module.exports.install = function (jasmine) {
    const global = jasmine.getGlobal();
    const _super = {
      describe: global.describe,
      fdescribe: global.fdescribe,
Severity: Major
Found in src/test-e2e/skip-plugin.js - About 2 hrs to fix

    Function sub has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        this.sub = messages.subscribe(jsonString => {
          const messageObj = JSON.parse(jsonString);
          if (messageObj) {
            if (messageObj.kind === 'ReleasePrefix') {
              prefix = messageObj.data;

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

        constructor(
          activatedRoute: ActivatedRoute,
        ) {
          this.editEndpoint = new FormGroup({
            name: new FormControl('', [Validators.required as any]),

        File kubernetes-endpoint.service.ts has 253 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { Injectable } from '@angular/core';
        import { Store } from '@ngrx/store';
        import { combineLatest, Observable, of } from 'rxjs';
        import { filter, first, map, shareReplay, startWith, switchMap } from 'rxjs/operators';
        
        

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

              it('text filter by non-existing', () => {
                // Clear and check initial cards
                appList.header.clearSearchText();
                expect(appList.header.getSearchText()).toBeFalsy();
                expect(appList.cards.getCardCount()).toBeGreaterThanOrEqual(appNames.length);
          Severity: Major
          Found in src/test-e2e/applications/application-wall-e2e.spec.ts and 1 other location - About 2 hrs to fix
          src/test-e2e/cloud-foundry/org-level/org-spaces-e2e.spec.ts on lines 180..198

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

          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

              it('text filter by non-existing', () => {
                // Clear and check initial cards
                spaceList.header.clearSearchText();
                expect(spaceList.header.getSearchText()).toBeFalsy();
                expect(spaceList.cards.getCardCount()).toBeGreaterThanOrEqual(spaceNames.length);
          Severity: Major
          Found in src/test-e2e/cloud-foundry/org-level/org-spaces-e2e.spec.ts and 1 other location - About 2 hrs to fix
          src/test-e2e/applications/application-wall-e2e.spec.ts on lines 242..260

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

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

          import { Component, Input, OnDestroy, OnInit, Output } from '@angular/core';
          import { Store } from '@ngrx/store';
          import { BehaviorSubject, combineLatest, Observable, Subscription } from 'rxjs';
          import { combineLatest as combineLatestOp, filter, first, map } from 'rxjs/operators';
          
          

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

              constructor(
                private activatedRoute: ActivatedRoute,
                router: Router
              ) {
                const serviceId = getIdFromRoute(activatedRoute, 'serviceId');

              Function fetchPolicy has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private fetchPolicy(
                  getPolicyAction: GetAppAutoscalerPolicyAction,
                  getPolicyTriggerAction?: GetAppAutoscalerPolicyTriggerAction): Observable<Action> {
                  const actionType = 'fetch';
                  this.store.dispatch(new StartRequestAction(getPolicyAction, actionType));
              Severity: Major
              Found in src/frontend/packages/cf-autoscaler/src/store/autoscaler.effects.ts - About 2 hrs to fix

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

                  constructor() {
                    const definition: StratosEndpointExtensionDefinition = {
                      type: GIT_ENDPOINT_TYPE,
                      label: 'Git',
                      labelPlural: 'Git',
                Severity: Major
                Found in src/frontend/packages/git/src/store/git-entity-generator.ts - About 2 hrs to fix

                  Function removeUserActions has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    removeUserActions(): IListAction<APIResource<CfUser>>[] {
                      const activeRouteCfOrgSpace = this.cfUserService.activeRouteCfOrgSpace;
                      const orgGuid = activeRouteCfOrgSpace.orgGuid;
                      const spaceGuid = activeRouteCfOrgSpace.spaceGuid;
                      const isCfContext = !orgGuid && !spaceGuid;

                    Function getColumns has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private getColumns(definition: KubeResourceEntityDefinition): ITableColumn<KubeAPIResource>[] {
                        const component = this.uiConfigService.previewComponent.get(definition.type);
                        let columns: Array<ITableColumn<KubeAPIResource>> = [
                          // Name
                          {

                      Method PgsqlTokenRepository.FindAllCNSITokenBackup has 75 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (p *PgsqlTokenRepository) FindAllCNSITokenBackup(cnsiGUID string, encryptionKey []byte) ([]interfaces.BackupTokenRecord, error) {
                          log.Debug("FindAllCNSITokenBackup")
                          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 2 hrs to fix

                        Function createCredential has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          createCredential() {
                            this.creating.next(true);
                            let action: UpdateAppAutoscalerCredentialAction;
                            if (this.editCredentialForm.controls.actype.value) {
                              action = new UpdateAppAutoscalerCredentialAction(this.applicationService.appGuid, this.applicationService.cfGuid);

                          Function parse has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            public parse(config: string): Observable<string> {
                              let doc: KubeConfigFile;
                          
                              const clusters: { [name: string]: KubeConfigFileCluster, } = {};
                          
                          

                            Method CFPushApp.Init has 74 lines of code (exceeds 50 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 1 hr to fix

                              Function generateCfTopLevelStoreEntities has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function generateCfTopLevelStoreEntities() {
                                return {
                                  createApplication: {
                                    cloudFoundryDetails: null,
                                    name: '',

                                Function PolymorphicSchema has 49 lines of code (exceeds 25 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 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language