cloudfoundry/stratos

View on GitHub

Showing 718 of 1,370 total issues

Function scan has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public scan(packageJson: any) {
    this.pkgReadMap = new Map<string, PackageInfo>();

    if (packageJson.peerDependencies) {
      Object.keys(packageJson.peerDependencies).forEach(dep => {
Severity: Minor
Found in src/frontend/packages/devkit/src/lib/packages.ts - About 1 hr to fix

    Method CFAppPush.getGitSCMSource has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
    Open

    func (cfAppPush *CFAppPush) getGitSCMSource(clientWebSocket *websocket.Conn, tempDir string, msg SocketMessage, userGUID string) (StratosProject, string, error) {
        var (
            err error
        )
    
    
    Severity: Minor
    Found in src/jetstream/plugins/cfapppush/deploy.go - 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 KubeDashboardProxy has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
    Open

    func KubeDashboardProxy(c echo.Context, p interfaces.PortalProxy, config *rest.Config) error {
        log.Debugf("KubeDashboardProxy request for: %s", c.Request().RequestURI)
    
        cnsiGUID := c.Param("guid")
        prefix := "/pp/v1/apps/kubedash/ui/" + cnsiGUID + "/"
    Severity: Minor
    Found in src/jetstream/plugins/kubernetes/dashboard/proxy.go - 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 ConfigInit has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
    Open

    func ConfigInit(envLookup *env.VarSet, jetstreamConfig *interfaces.PortalConfig) {
    
        // Check we are deployed in Cloud Foundry
        if !envLookup.IsSet(VCapApplication) {
            return
    Severity: Minor
    Found in src/jetstream/plugins/cloudfoundryhosting/main.go - 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

    Method portalProxy.verifySession has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
    Open

    func (p *portalProxy) verifySession(c echo.Context) error {
        log.Debug("verifySession")
    
        p.StratosAuthService.BeforeVerifySession(c)
    
    
    Severity: Minor
    Found in src/jetstream/session.go - 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 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 doCreateWindow has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function doCreateWindow(url) {
    
      let mainWindowState = windowStateKeeper({
        defaultWidth: 1024,
        defaultHeight: 768
    Severity: Minor
    Found in electron/index.js - About 1 hr to fix

      Function onRunComplete has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          this.onRunComplete = (browser, result) => {
      
            if (fs.existsSync(this.file)) {
              fs.unlinkSync(this.file);
            }
      Severity: Minor
      Found in build/karma.test.reporter.js - About 1 hr to fix

        Function allUsers$ has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                switchMap(cf => {
                  const isAdmin = cf.global.isAdmin;
                  // Note - This service is used at cf, org and space level of the cf pages.
                  // We shouldn't attempt to fetch all users if at the cf level
                  if (

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

              private doEndpointAction(
                apiAction: EntityRequestAction | PaginatedAction,
                url: string,
                params: HttpParams,
                apiActionType: ApiRequestTypes = 'update',
            Severity: Minor
            Found in src/frontend/packages/store/src/effects/endpoint.effects.ts - About 1 hr to fix

              Function jetstreamErrorHandler has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function jetstreamErrorHandler(
                error: any,
                action: EntityRequestAction,
                catalogEntity: StratosBaseCatalogEntity,
                requestType: ApiRequestTypes,

                Function parseKeyValue has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private parseKeyValue(key: any, value: any): Segment {
                    const segment: Segment = {
                      key,
                      value,
                      type: undefined,

                  Function ngOnInit has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    ngOnInit() {
                      this.hasFavEntities = this.userFavoriteManager.endpointHasEntitiesThatCanFavorite(this.endpoint.cnsi_type);
                      // Favorites for this endpoint
                      this.favorites$ = this.userFavoriteManager.getFavoritesForEndpoint(this.endpoint.guid);
                      this.entity = entityCatalog.getEndpoint(this.endpoint.cnsi_type, this.endpoint.sub_type);

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

                      constructor(
                        private store: Store<CFAppState>,
                        private cSIHelperServiceFactory: CreateServiceInstanceHelperServiceFactory,
                        activatedRoute: ActivatedRoute,
                        private componentFactoryResolver: ComponentFactoryResolver,

                      Function ngOnInit has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        ngOnInit() {
                          const chartConfigBuilder = getMetricsChartConfigBuilder<IMetricApplication>(
                            result => {
                              const metric = result.metric;
                              if (!!metric.pod && !!metric.namespace) {

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

                          private setup(row: APIResource<IUserProvidedServiceInstance>) {
                            this.serviceInstanceEntity = row;
                            const schema = cfEntityFactory(userProvidedServiceInstanceEntityType);
                            this.entityConfig = new ComponentEntityMonitorConfig(row.metadata.guid, schema);
                            this.serviceInstanceTags = (row.entity.tags || []).map(t => ({

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

                              constructor(
                                public cfEndpointService: CloudFoundryEndpointService,
                                private currentUserPermissionsService: CurrentUserPermissionsService,
                                endpointsService: EndpointsService,
                                userFavoriteManager: UserFavoriteManager

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

                                ngOnInit() {
                                  this.subscriptions.push(this.addTCPRoute.valueChanges.subscribe(val => {
                                    const useRandomPort = val.useRandomPort;
                                    if (useRandomPort !== this.useRandomPort) {
                                      this.useRandomPort = useRandomPort;
                                Severity
                                Category
                                Status
                                Source
                                Language