cloudfoundry/stratos

View on GitHub

Showing 718 of 1,370 total issues

Function newPortalProxy has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

func newPortalProxy(pc interfaces.PortalConfig, dcp *sql.DB, ss HttpSessionStore, sessionStoreOptions *sessions.Options, env *env.VarSet) *portalProxy {
Severity: Minor
Found in src/jetstream/main.go - About 35 mins to fix

    Function start has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func start(config interfaces.PortalConfig, p *portalProxy, needSetupMiddleware bool, isUpgrade bool, envLookup *env.VarSet) error {
    Severity: Minor
    Found in src/jetstream/main.go - About 35 mins to fix

      Method portalProxy.login has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func (p *portalProxy) login(c echo.Context, skipSSLValidation bool, client string, clientSecret string, endpoint string) (uaaRes *interfaces.UAAResponse, u *interfaces.JWTUserTokenInfo, err error) {
      Severity: Minor
      Found in src/jetstream/auth.go - About 35 mins to fix

        Function handleSessionError has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func handleSessionError(config interfaces.PortalConfig, c echo.Context, err error, doNotLog bool, msg string) error {
        Severity: Minor
        Found in src/jetstream/middleware.go - About 35 mins to fix

          Function insertEmptyMetrics has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            data: AppAutoscalerMetricDataPoint[],
            startTime: number,
            endTime: number,
            interval: number,
            timezone?: string

            Function createService has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                marketplaceSummaryPage: MarketplaceSummaryPage,
                servicesHelperE2E: ServicesHelperE2E,
                serviceName: string,
                servicesWall: ServicesWallPage,
                serviceInstanceName: string

              Function transformMetricData has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                source: AppAutoscalerMetricData[],
                interval: number,
                startTime: number,
                endTime: number,
                timezone: string): AppAutoscalerMetricDataPoint[] {

                Function setUpTestOrgSpaceE2eTest has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  orgName: string,
                  spaceName: string,
                  userName: string,
                  dropBillingManager = false,
                  e2eSetup?: E2ESetup
                Severity: Minor
                Found in src/test-e2e/cloud-foundry/users-list-e2e.helper.ts - About 35 mins to fix

                  Function applicationServiceFactory has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    cfId: string,
                    id: string,
                    store: Store<CFAppState>,
                    appStateService: ApplicationStateService,
                    appEnvVarsService: ApplicationEnvVarsHelper,

                    Function mapMultiEndpointResponses has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      action: EntityRequestAction,
                      catalogEntity: StratosBaseCatalogEntity,
                      requestType: ApiRequestTypes,
                      multiEndpointResponses: HandledMultiEndpointResponse,
                      actionDispatcher: (actionToDispatch: Action) => void

                      Function getFailApiRequestActions has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        apiAction: EntityRequestAction,
                        error,
                        requestType: ApiRequestTypes = 'fetch',
                        catalogEntity: StratosBaseCatalogEntity,
                        internalEndpointError?: InternalEndpointError,

                        Method OIDCKubeAuth.GetOIDCConfig has 5 return statements (exceeds 4 allowed).
                        Open

                        func (c *OIDCKubeAuth) GetOIDCConfig(k *config.KubeConfigUser) (*KubeConfigAuthProviderOIDC, error) {
                        
                            if k.User.AuthProvider.Name != "oidc" {
                                return nil, errors.New("User doesn't use OIDC")
                            }
                        Severity: Major
                        Found in src/jetstream/plugins/kubernetes/auth/oidc.go - About 35 mins to fix

                          Method KubernetesSpecification.GetHelmConfiguration has 5 return statements (exceeds 4 allowed).
                          Open

                          func (c *KubernetesSpecification) GetHelmConfiguration(endpointGUID, userID, namespace string) (*action.Configuration, *HelmConfiguration, error) {
                              // Need to get a config object for the target endpoint
                              var p = c.portalProxy
                          
                              hc := &HelmConfiguration{}
                          Severity: Major
                          Found in src/jetstream/plugins/kubernetes/helm_client.go - About 35 mins to fix

                            Function getKubeDashboardSecretToken has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
                            Open

                            func getKubeDashboardSecretToken(p interfaces.PortalProxy, cnsiGUID, userGUID string, sa *v1.ServiceAccount) (string, error) {
                                log.Debug("getKubeDashboardSecretToken request")
                            
                                namespace := sa.Namespace
                            
                            
                            Severity: Minor
                            Found in src/jetstream/plugins/kubernetes/dashboard/common.go - About 35 mins 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 HelmReleaseGraph.ProcessService has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
                            Open

                            func (r *HelmReleaseGraph) ProcessService(id string, res KubeResource, spec v1.ServiceSpec) {
                                if len(spec.Selector) > 0 {
                                    // Find all Pods that match this selector
                                    for _, item := range r.Release.Resources {
                                        switch o := item.Resource.(type) {
                            Severity: Minor
                            Found in src/jetstream/plugins/kubernetes/helm/graph.go - About 35 mins 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 getKubeDashboardPod has 5 return statements (exceeds 4 allowed).
                            Open

                            func getKubeDashboardPod(p interfaces.PortalProxy, cnsiGUID, userGUID string, labelSelector string) (*v1.Pod, error) {
                                log.Debug("kubeDashboardStatus request")
                            
                                response, err := p.DoProxySingleRequest(cnsiGUID, userGUID, "GET", "/api/v1/pods?labelSelector="+labelSelector, nil, nil)
                                if err != nil || response.StatusCode != 200 {
                            Severity: Major
                            Found in src/jetstream/plugins/kubernetes/dashboard/common.go - About 35 mins to fix

                              Method UserInvite.SendEmail has 5 return statements (exceeds 4 allowed).
                              Open

                              func (invite *UserInvite) SendEmail(emailAddress, inviteLink string, endpoint interfaces.CNSIRecord) error {
                                  log.Debugf("User Invite: Sending Email to: %s", emailAddress)
                                  mailHost := fmt.Sprintf("%s:%d", invite.Config.SMTP.Host, invite.Config.SMTP.Port)
                              
                                  var auth smtp.Auth
                              Severity: Major
                              Found in src/jetstream/plugins/userinvite/email.go - About 35 mins to fix

                                Method AzureKubeAuth.FetchToken has 5 return statements (exceeds 4 allowed).
                                Open

                                func (p *AzureKubeAuth) FetchToken(cnsiRecord interfaces.CNSIRecord, ec echo.Context) (*interfaces.TokenRecord, *interfaces.CNSIRecord, error) {
                                    req := ec.Request()
                                
                                    // Need to extract the parameters from the request body
                                    defer req.Body.Close()
                                Severity: Major
                                Found in src/jetstream/plugins/kubernetes/auth/azure.go - About 35 mins to fix

                                  Function fetchManifest has 5 return statements (exceeds 4 allowed).
                                  Open

                                  func fetchManifest(repoPath string, stratosProject StratosProject, clientWebSocket *websocket.Conn) (Applications, string, error) {
                                  
                                      var manifest Applications
                                  
                                      // Can be either manifest.yml or manifest.yaml
                                  Severity: Major
                                  Found in src/jetstream/plugins/cfapppush/deploy.go - About 35 mins to fix

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

                                    func (a *Analyzer) Start() {
                                    
                                        // Reports folder
                                    
                                        // Init reports directory
                                    Severity: Minor
                                    Found in src/jetstream/plugins/analysis/container/main.go - About 35 mins 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