SUSE/stratos

View on GitHub

Showing 1,395 of 1,395 total issues

Method portalProxy.login has 5 return statements (exceeds 4 allowed).
Open

func (p *portalProxy) login(c echo.Context, skipSSLValidation bool, client string, clientSecret string, endpoint string) (uaaRes *interfaces.UAAResponse, u *interfaces.JWTUserTokenInfo, err error) {
    log.Debug("login")
    if c.Request().Method == http.MethodGet {
        code := c.QueryParam("code")
        state := c.QueryParam("state")
Severity: Major
Found in src/jetstream/auth.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 LocalUserInfo.UpdateUserInfo has 5 return statements (exceeds 4 allowed).
      Open

      func (userInfo *LocalUserInfo) UpdateUserInfo(profile *uaaUser) (int, error) {
      
          // Fetch the user, make updates and save
          id := profile.ID
          localUsersRepo, err := localusers.NewPgsqlLocalUsersRepository(userInfo.portalProxy.GetDatabaseConnection())
      Severity: Major
      Found in src/jetstream/plugins/userinfo/local_user.go - About 35 mins to fix

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

        func (k *KubeTerminal) createPod(c echo.Context, kubeConfig, kubeVersion string, ws *websocket.Conn) (*PodCreationData, error) {
            // Unique ID for the secret and pod name
            id := uuid.NewV4().String()
            id = strings.ReplaceAll(id, "-", "")
            // Names for the secret and pod
        Severity: Minor
        Found in src/jetstream/plugins/kubernetes/terminal/helpers.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 UnMarshalHelper has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
        Open

        func UnMarshalHelper(values map[string]interface{}, intf interface{}) error {
        
            value := reflect.ValueOf(intf)
        
            if value.Kind() != reflect.Ptr {
        Severity: Minor
        Found in src/jetstream/plugins/kubernetes/config/kube_config.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 MetricsSpecification.createMetadata has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
        Open

        func (m *MetricsSpecification) createMetadata(metricEndpoint *url.URL, httpClient http.Client, auth *MetricsAuth) (string, error) {
            basicMetricRequest := fmt.Sprintf("%s/api/v1/query?query=firehose_total_metrics_received", metricEndpoint)
            req, err := http.NewRequest("GET", basicMetricRequest, nil)
            if err != nil {
                msg := "Failed to create request for the Metrics Endpoint: %v"
        Severity: Minor
        Found in src/jetstream/plugins/metrics/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

        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

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

          func (c *CertKubeAuth) DoFlowRequest(cnsiRequest *interfaces.CNSIRequest, req *http.Request) (*http.Response, error) {
              log.Debug("doCertAuthFlowRequest")
          
              authHandler := func(tokenRec interfaces.TokenRecord, cnsi interfaces.CNSIRecord) (*http.Response, error) {
          
          
          Severity: Minor
          Found in src/jetstream/plugins/kubernetes/auth/cert.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 portalProxy.loginToCNSI has 5 return statements (exceeds 4 allowed).
          Open

          func (p *portalProxy) loginToCNSI(c echo.Context) error {
              log.Debug("loginToCNSI")
          
              var systemSharedToken = false
          
          
          Severity: Major
          Found in src/jetstream/authcnsi.go - About 35 mins to fix

            Method Monocular.artifactHubCacheChartFiles has 5 return statements (exceeds 4 allowed).
            Open

            func (m *Monocular) artifactHubCacheChartFiles(endpointID, repoName, repoURL, name, version, digest string) (string, error) {
            
                // First look to see if there is a digest file
                cacheFolder := path.Join(m.CacheFolder, endpointID, fmt.Sprintf("%s_%s_%s", repoName, name, version))
                if hasDigestFile(cacheFolder, digest) {
            Severity: Major
            Found in src/jetstream/plugins/monocular/artifacthub.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

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

                func getScriptFolder() string {
                    fallbackPath, err := os.Getwd()
                    if err != nil {
                        fallbackPath = "."
                    }
                Severity: Major
                Found in src/jetstream/plugins/analysis/container/main.go - About 35 mins to fix

                  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

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

                    func getKubeDashboardServiceAccount(p interfaces.PortalProxy, cnsiGUID, userGUID string, labelSelector string) (*v1.ServiceAccount, error) {
                        log.Debug("getKubeDashboardService request")
                    
                        response, err := p.DoProxySingleRequest(cnsiGUID, userGUID, "GET", "/api/v1/serviceaccounts?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 Analysis.deleteReports has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
                      Open

                      func (c *Analysis) deleteReports(ec echo.Context) error {
                          log.Debug("deleteReports")
                          var p = c.portalProxy
                      
                          // Need to get a config object for the target endpoint
                      Severity: Minor
                      Found in src/jetstream/plugins/analysis/list.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 SemanticVersion.LessThan has 5 return statements (exceeds 4 allowed).
                        Open

                        func (s *SemanticVersion) LessThan(d *SemanticVersion) bool {
                            if d == nil {
                                return true
                            }
                            if s.Valid && d.Valid {
                        Severity: Major
                        Found in src/jetstream/plugins/monocular/store/version.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

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

                            func (cw PushConnectionWrapper) Make(request *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error {
                                // Check to see if the token is about to expire, if it is, refresh it first
                                token, found := cw.portalProxy.GetCNSITokenRecord(cw.config.EndpointID, cw.config.UserID)
                                if found {
                                    // Aways update the access token, in case someone else refreshed it
                            Severity: Minor
                            Found in src/jetstream/plugins/cfapppush/connection_wrapper.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

                            Severity
                            Category
                            Status
                            Source
                            Language