horizoncd/horizon

View on GitHub

Showing 440 of 677 total issues

Method controller.validateCreate has 5 return statements (exceeds 4 allowed).
Open

func (c *controller) validateCreate(r *CreateClusterRequest) error {
if err := validateClusterName(r.Name); err != nil {
return err
}
if r.Git == nil || r.Git.Ref() == "" || r.Git.RefType() == "" {
Severity: Major
Found in core/controller/cluster/controller_basic.go - About 35 mins to fix

    Method controller.Review has 5 return statements (exceeds 4 allowed).
    Open

    func (c *controller) Review(ctx context.Context, apis []API) (map[string]map[string]*ReviewResult, error) {
    reviewResponse := make(map[string]map[string]*ReviewResult)
    // get user info
    currentUser, err := common.UserFromContext(ctx)
    if err != nil {
    Severity: Major
    Found in core/controller/access/controller.go - About 35 mins to fix

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

      func handleGetSchema(c *gin.Context, mgr *managerparam.Manager, r *gin.Engine,
      authRecord auth.AttributesRecord, requestInfo *auth.RequestInfo) {
      template, err := mgr.TemplateMgr.GetByName(c, authRecord.Name)
      if err != nil {
      if e, ok := perror.Cause(err).(*herrors.HorizonErrNotFound); ok && e.Source == herrors.TemplateInDB {
      Severity: Major
      Found in core/middleware/prehandle/prehandle.go - About 35 mins to fix

        Method API.ExecuteAction has 5 return statements (exceeds 4 allowed).
        Open

        func (a *API) ExecuteAction(c *gin.Context) {
        const op = "cluster: execute action"
        clusterIDStr := c.Param(common.ParamClusterID)
        clusterID, err := strconv.ParseUint(clusterIDStr, 10, 0)
        if err != nil {
        Severity: Major
        Found in core/http/api/v2/cluster/apis_operation.go - About 35 mins to fix

          Method API.PodEvents has 5 return statements (exceeds 4 allowed).
          Open

          func (a *API) PodEvents(c *gin.Context) {
          op := "cluster: pod events"
          clusterIDStr := c.Param(common.ParamClusterID)
          clusterID, err := strconv.ParseUint(clusterIDStr, 10, 0)
          if err != nil {
          Severity: Major
          Found in core/http/api/v2/cluster/apis_operation.go - About 35 mins to fix

            Method API.UpdateMember has 5 return statements (exceeds 4 allowed).
            Open

            func (a *API) UpdateMember(c *gin.Context) {
            memberIDStr := c.Param(_paramMemberID)
            uintID, err := strconv.ParseUint(memberIDStr, 10, 0)
            if err != nil {
            response.AbortWithRequestError(c, common.InvalidRequestParam,
            Severity: Major
            Found in core/http/api/v2/member/apis.go - About 35 mins to fix

              Method controller.CreateResourceAccessToken has 5 return statements (exceeds 4 allowed).
              Open

              func (c *controller) CreateResourceAccessToken(ctx context.Context, request CreateResourceAccessTokenRequest,
              resourceType string, resourceID uint) (*CreateResourceAccessTokenResponse, error) {
              var (
              userID uint
              )
              Severity: Major
              Found in core/controller/accesstoken/controller.go - About 35 mins to fix

                Method controller.validateTemplateInput has 5 return statements (exceeds 4 allowed).
                Open

                func (c *controller) validateTemplateInput(ctx context.Context,
                template, release string, templateInput *TemplateInput) error {
                tr, err := c.templateReleaseMgr.GetByTemplateNameAndRelease(ctx, template, release)
                if err != nil {
                return err
                Severity: Major
                Found in core/controller/application/controller.go - About 35 mins to fix

                  Method API.Deploy has 5 return statements (exceeds 4 allowed).
                  Open

                  func (a *API) Deploy(c *gin.Context) {
                  op := "cluster: deploy"
                  clusterIDStr := c.Param(common.ParamClusterID)
                  clusterID, err := strconv.ParseUint(clusterIDStr, 10, 0)
                  if err != nil {
                  Severity: Major
                  Found in core/http/api/v2/cluster/apis_operation.go - About 35 mins to fix

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

                    func validateClusterName(name string) error {
                    if len(name) == 0 {
                    return perror.Wrap(herrors.ErrParamInvalid, "name cannot be empty")
                    }
                     
                     
                    Severity: Major
                    Found in core/controller/cluster/controller_basic.go - About 35 mins to fix

                      Method API.UpdateWebhook has 5 return statements (exceeds 4 allowed).
                      Open

                      func (a *API) UpdateWebhook(c *gin.Context) {
                      const op = "webhook: update"
                      idStr := c.Param(_webhookIDParam)
                      id, err := strconv.ParseUint(idStr, 10, 0)
                      if err != nil {
                      Severity: Major
                      Found in core/http/api/v2/webhook/apis.go - About 35 mins to fix

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

                        func validateApplicationName(name string) error {
                        if len(name) == 0 {
                        return perror.Wrap(herrors.ErrParamInvalid, "name cannot be empty")
                        }
                         
                         
                        Severity: Major
                        Found in core/controller/application/controller.go - About 35 mins to fix

                          Method API.Update has 5 return statements (exceeds 4 allowed).
                          Open

                          func (a *API) Update(c *gin.Context) {
                          const op = "tag: update"
                          resourceType := c.Param(_resourceTypeParam)
                          resourceIDStr := c.Param(_resourceIDParam)
                          resourceID, err := strconv.ParseUint(resourceIDStr, 10, 0)
                          Severity: Major
                          Found in core/http/api/v2/tag/apis.go - About 35 mins to fix

                            Method controller.DeleteLinksByID has 5 return statements (exceeds 4 allowed).
                            Open

                            func (c *controller) DeleteLinksByID(ctx context.Context, id uint) error {
                            user, err := common.UserFromContext(ctx)
                            if err != nil {
                            return err
                            }
                            Severity: Major
                            Found in core/controller/user/controller.go - About 35 mins to fix

                              Method API.List has 5 return statements (exceeds 4 allowed).
                              Open

                              func (a *API) List(c *gin.Context) {
                              withFullPathStr := c.Query(_withFullPath)
                              withFullPath, _ := strconv.ParseBool(withFullPathStr)
                               
                              keywords := q.KeyWords{}
                              Severity: Major
                              Found in core/http/api/v2/template/apis.go - About 35 mins to fix

                                Method API.Transfer has 5 return statements (exceeds 4 allowed).
                                Open

                                func (a *API) Transfer(c *gin.Context) {
                                const op = "application: transfer"
                                appIDStr := c.Param(common.ParamApplicationID)
                                appID, err := strconv.ParseUint(appIDStr, 10, 0)
                                if err != nil {
                                Severity: Major
                                Found in core/http/api/v2/application/apis.go - About 35 mins to fix

                                  Method service.IsHealthy has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                                  Open

                                  func (s *service) IsHealthy(node *v1alpha1.ResourceNode,
                                  client *kube.Client) (bool, error) {
                                  instance, err := s.getServiceByNode(node, client)
                                  if err != nil {
                                  return true, err
                                  Severity: Minor
                                  Found in pkg/workload/kservice/kservice.go - About 25 mins to fix

                                  Method controller.handleJibBuild has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                                  Open

                                  func (c *controller) handleJibBuild(ctx context.Context, result *tekton.PipelineResults,
                                  data *global.HorizonMetaData) error {
                                  clusterID := data.ClusterID
                                  cluster, err := c.clusterMgr.GetByID(ctx, clusterID)
                                  if err != nil {
                                  Severity: Minor
                                  Found in core/controller/cloudevent/controller.go - About 25 mins to fix

                                  Function getScope has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                                  Open

                                  func getScope(c *gin.Context, mgr *managerparam.Manager, resourceType,
                                  resourceName string) (string, error) {
                                  var (
                                  resourceID uint
                                  cluster *clustermodels.Cluster
                                  Severity: Minor
                                  Found in core/middleware/scope/scope.go - About 25 mins to fix

                                  Function akskAuthn has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                                  Open

                                  func akskAuthn(c *gin.Context, keys authenticate.KeysConfig, userMgr usermanager.Manager) (*models.User, error) {
                                  r := c.Request
                                  log.Infof(c, "request url path: %v", r.URL)
                                   
                                  operator := r.Header.Get(HTTPHeaderOperator)
                                  Severity: Minor
                                  Found in core/middleware/user/user.go - About 25 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language