cloudfoundry/stratos

View on GitHub
src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts

Summary

Maintainability
F
5 days
Test Coverage

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

import { Compiler, Injector } from '@angular/core';
import { Action, Store } from '@ngrx/store';
import { entityFetchedWithoutError } from '@stratosui/store';
import { combineLatest, Observable, of } from 'rxjs';
import { first, map } from 'rxjs/operators';
Severity: Major
Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 2 days to fix

    Function generateCFEntities has 153 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function generateCFEntities(): StratosBaseCatalogEntity[] {
      const endpointDefinition: StratosEndpointExtensionDefinition = {
        urlValidationRegexString: urlValidationExpression,
        type: CF_ENDPOINT_TYPE,
        label: 'Cloud Foundry',
    Severity: Major
    Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 6 hrs to fix

      Function generateCFEntities has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
      Open

      export function generateCFEntities(): StratosBaseCatalogEntity[] {
        const endpointDefinition: StratosEndpointExtensionDefinition = {
          urlValidationRegexString: urlValidationExpression,
          type: CF_ENDPOINT_TYPE,
          label: 'Cloud Foundry',
      Severity: Minor
      Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr 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 generateCFAppEnvVarEntity has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function generateCFAppEnvVarEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
        const definition: IStratosEntityDefinition<any, APIResource, any> = {
          type: appEnvVarsEntityType,
          schema: cfEntityFactory(appEnvVarsEntityType),
          endpoint: endpointDefinition,
      Severity: Minor
      Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

        Function generateFeatureFlagEntity has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function generateFeatureFlagEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
          const featureFlagDefinition: IStratosEntityDefinition = {
            type: featureFlagEntityType,
            schema: cfEntityFactory(featureFlagEntityType),
            label: 'Feature Flag',
        Severity: Minor
        Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

          Function generateCFAppStatsEntity has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function generateCFAppStatsEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
            const definition: IStratosEntityDefinition<any, AppStat> = {
              type: appStatsEntityType,
              schema: cfEntityFactory(appStatsEntityType),
              endpoint: endpointDefinition,
          Severity: Minor
          Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

            Function generateCfApplicationEntity has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function generateCfApplicationEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
              const applicationDefinition: IStratosEntityDefinition<EntitySchema, APIResource<IApp>> = {
                type: applicationEntityType,
                schema: cfEntityFactory(applicationEntityType),
                label: 'Application',
            Severity: Minor
            Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

              Function generateCfOrgEntity has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function generateCfOrgEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
                const orgDefinition: IStratosEntityDefinition = {
                  type: organizationEntityType,
                  schema: cfEntityFactory(organizationEntityType),
                  label: 'Organization',
              Severity: Minor
              Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

                Function generateCfSpaceEntity has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function generateCfSpaceEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
                  const spaceDefinition: IStratosEntityDefinition = {
                    type: spaceEntityType,
                    schema: {
                      default: cfEntityFactory(spaceEntityType),
                Severity: Minor
                Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

                  Function generateCFServiceInstanceEntity has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function generateCFServiceInstanceEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
                    const definition: IStratosEntityDefinition = {
                      type: serviceInstancesEntityType,
                      schema: {
                        default: cfEntityFactory(serviceInstancesEntityType),
                  Severity: Minor
                  Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

                    Function generateCFServiceBindingEntity has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Wontfix

                    function generateCFServiceBindingEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
                      const definition: IStratosEntityDefinition = {
                        type: serviceBindingEntityType,
                        schema: {
                          default: cfEntityFactory(serviceBindingEntityType),
                    Severity: Minor
                    Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

                      Function generateRouteEntity has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Wontfix

                      function generateRouteEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
                        const definition: IStratosEntityDefinition = {
                          type: routeEntityType,
                          schema: cfEntityFactory(routeEntityType),
                          label: 'Application Route',
                      Severity: Minor
                      Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

                        Function generateCFUserProvidedServiceInstanceEntity has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Wontfix

                        function generateCFUserProvidedServiceInstanceEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
                          const definition: IStratosEntityDefinition = {
                            type: userProvidedServiceInstanceEntityType,
                            schema: cfEntityFactory(userProvidedServiceInstanceEntityType),
                            label: 'User Provided Service Instance',
                        Severity: Minor
                        Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

                          Function generateEventEntity has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Wontfix

                          function generateEventEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
                            const definition: IStratosEntityDefinition = {
                              type: cfEventEntityType,
                              schema: cfEntityFactory(cfEventEntityType),
                              label: 'Event',
                          Severity: Minor
                          Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

                            Function generateCFServicePlanEntity has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Wontfix

                            function generateCFServicePlanEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
                              const definition: IStratosEntityDefinition = {
                                type: servicePlanEntityType,
                                schema: cfEntityFactory(servicePlanEntityType),
                                label: 'Service Plan',
                            Severity: Minor
                            Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

                              Function generateCFServiceEntity has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Wontfix

                              function generateCFServiceEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
                                const definition: IStratosEntityDefinition = {
                                  type: serviceEntityType,
                                  schema: cfEntityFactory(serviceEntityType),
                                  label: 'Service',
                              Severity: Minor
                              Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

                                Function generateCFDomainEntity has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Wontfix

                                function generateCFDomainEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
                                  const definition: IStratosEntityDefinition = {
                                    type: domainEntityType,
                                    schema: cfEntityFactory(domainEntityType),
                                    label: 'Domain',
                                Severity: Minor
                                Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

                                  Function generateStackEntity has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Wontfix

                                  function generateStackEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
                                    const definition: IStratosEntityDefinition = {
                                      type: stackEntityType,
                                      schema: cfEntityFactory(stackEntityType),
                                      label: 'Stack',
                                  Severity: Minor
                                  Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

                                    TODO found
                                    Wontfix

                                            // TODO: See #4205

                                    There are no issues that match your filters.

                                    Category
                                    Status