cloudfoundry/stratos

View on GitHub

Showing 718 of 1,370 total issues

Function graph has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    ).subscribe(([g, report]) => {
      const newNodes: CustomHelmReleaseGraphNode[] = [];
      Object.values(g.nodes).forEach((node: HelmReleaseGraphNode) => {
        const colors = this.getColor(node.data.status);
        const icon = getIcon(node.data.kind);

    Method UserInvite.refreshToken has 62 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (invite *UserInvite) refreshToken(clientID, clientSecret string, endpoint interfaces.CNSIRecord) (*interfaces.UAAResponse, *interfaces.TokenRecord, error) {
        now := time.Now()
        clientSecret = strings.TrimSpace(clientSecret)
        authEndpoint := fmt.Sprintf("%s/oauth/token", endpoint.TokenEndpoint)
    
    
    Severity: Minor
    Found in src/jetstream/plugins/userinvite/auth.go - About 1 hr to fix

      Function start has 62 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func start(config interfaces.PortalConfig, p *portalProxy, needSetupMiddleware bool, isUpgrade bool, envLookup *env.VarSet) error {
          log.Debug("start")
          e := echo.New()
          e.HideBanner = true
          e.HidePort = true
      Severity: Minor
      Found in src/jetstream/main.go - About 1 hr to fix

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

          function setup(spaceName: string, routeHosts: string[], orderImportant: boolean) {
            defaultCf = e2e.secrets.getDefaultCFEndpoint();
            endpointGuid = e2e.helper.getEndpointGuid(e2e.info, defaultCf.name);
            const defaultOrgGuidP = CFHelpers.cachedDefaultOrgGuid ?
              promise.fullyResolved<string>(CFHelpers.cachedDefaultOrgGuid) : cfHelper.fetchDefaultOrgGuid();
        Severity: Minor
        Found in src/test-e2e/cloud-foundry/space-level/space-routes-e2e.spec.ts - About 1 hr to fix

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

            constructor(
              private store: Store<CFAppState>,
              private paginationMonitorFactory: PaginationMonitorFactory,
              private csiGuidService: CsiGuidsService,
              private servicesWallService: ServicesWallService

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

              deleteOrgWarn() {
                this.cfOrgService.org$.pipe(
                  map(org => org.entity.entity.name),
                  first()
                ).subscribe(name => {

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

                  public apply(webpackConfig: any, config: StratosConfig, options: any) {
                
                    // Generate the module file to import the appropriate extensions
                    const dir = path.join(config.rootDir, path.dirname(options.main));
                    const overrideFile = path.resolve(path.join(dir, './_custom-import.module.ts'));
                Severity: Minor
                Found in src/frontend/packages/devkit/src/build/extensions.ts - About 1 hr to fix

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

                    private initialiseObservables() {
                      this.org$ = this.cfUserService.isConnectedUserAdmin(this.cfGuid).pipe(
                        switchMap(isAdmin => {
                          const relations = [
                            createEntityRelationKey(organizationEntityType, spaceEntityType),

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

                      ngOnInit() {
                        this.endpointId = this.activatedRoute.snapshot.params && this.activatedRoute.snapshot.params.endpointId ?
                          this.activatedRoute.snapshot.params.endpointId : null;
                        if (!this.endpointIds$ && this.endpointId) {
                          this.endpointIds$ = observableOf([this.endpointId]);

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

                        ngOnInit() {
                          const userRole$ = this.cfEndpointService.currentUser$.pipe(
                            switchMap(u => {
                              // This is null if the endpoint is disconnected. Probably related to https://github.com/cloudfoundry-incubator/stratos/issues/1727
                              if (!u) {

                        Function createAppReducer has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function createAppReducer(state: CreateNewApplicationState = defaultState, action) {
                          switch (action.type) {
                            case SET_CF_DETAILS:
                              return {
                                ...state, cloudFoundryDetails: action.cloudFoundryDetails

                          Function installChart has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            installChart(): Observable<StepOnNextResult> {
                              const endpoint = getMonocularEndpoint(this.route, null, null);
                              // Build the request body
                              const values: HelmInstallValues = {
                                ...this.details.value,

                            Function mapPods has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              private mapPods(pods: KubernetesPod[]): HelmReleaseChartData {
                                const podPhases: { [phase: string]: number, } = {};
                                const containers = {
                                  ready: {
                                    name: 'Ready',

                              Function load has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                load(): Observable<boolean> {
                                  const guid = this.endpoint.guid;
                                  const podsObs = kubeEntityCatalog.pod.store.getPaginationService(guid);
                                  const pods$ = podsObs.entities$;
                                  const nodesObs = kubeEntityCatalog.node.store.getPaginationService(guid);

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

                                  constructor(
                                    public kubeEndpointService: KubernetesEndpointService,
                                    public activatedRoute: ActivatedRoute,
                                    public store: Store<AppState>,
                                    private snackbarService: SnackBarService

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

                                  func (k *KubeTerminal) Start(c echo.Context) error {
                                      log.Debug("Kube Terminal start request")
                                  
                                      endpointGUID := c.Param("guid")
                                      userGUID := c.Get("user_id").(string)
                                  Severity: Minor
                                  Found in src/jetstream/plugins/kubernetes/terminal/start.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.loginToUAA has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
                                  Open

                                  func (p *portalProxy) loginToUAA(c echo.Context) (*interfaces.LoginRes, error) {
                                      log.Debug("loginToUAA")
                                      uaaRes, u, err := p.login(c, p.Config.ConsoleConfig.SkipSSLValidation, p.Config.ConsoleConfig.ConsoleClient, p.Config.ConsoleConfig.ConsoleClientSecret, p.getUAAIdentityEndpoint())
                                      var resp *interfaces.LoginRes
                                      if err != nil {
                                  Severity: Minor
                                  Found in src/jetstream/authuaa.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 TokenStore.FindCNSIToken has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
                                  Open

                                  func (d *TokenStore) FindCNSIToken(cnsiGUID string, userGUID string, encryptionKey []byte) (interfaces.TokenRecord, error) {
                                  
                                      local, cfg, err := ListKubernetes()
                                      if err == nil {
                                          for _, cluster := range local {
                                  Severity: Minor
                                  Found in src/jetstream/plugins/desktop/kubernetes/tokens.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.initialiseConsoleConfig has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
                                  Open

                                  func (p *portalProxy) initialiseConsoleConfig(envLookup *env.VarSet) (*interfaces.ConsoleConfig, error) {
                                      log.Debug("initialiseConsoleConfig")
                                  
                                      consoleConfig := &interfaces.ConsoleConfig{}
                                      if err := config.Load(consoleConfig, envLookup.Lookup); err != nil {
                                  Severity: Minor
                                  Found in src/jetstream/setup_console.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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language