horizoncd/horizon

View on GitHub

Showing 440 of 677 total issues

Method EnvironmentList.Less has 5 return statements (exceeds 4 allowed).
Open

func (e EnvironmentList) Less(i, j int) bool {
const pre = "pre"
const online = "online"
if e[i].Name == online {
return false
Severity: Major
Found in pkg/environment/models/environment.go - About 35 mins to fix

    Method dao.ListWebhookLogs has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
    Open

    func (d *dao) ListWebhookLogs(ctx context.Context, query *q.Query,
    resources map[string][]uint) ([]*models.WebhookLogWithEventInfo, int64, error) {
    var (
    logs []*models.WebhookLogWithEventInfo
    count int64
    Severity: Minor
    Found in pkg/webhook/dao/dao.go - About 35 mins to fix

    Method Helper.GetTagArchive has 5 return statements (exceeds 4 allowed).
    Open

    func (h Helper) GetTagArchive(ctx context.Context, gitURL, tagName string) (*git.Tag, error) {
    URL, err := url.Parse(gitURL)
    if err != nil || gitURL == "" {
    return nil, perror.Wrap(herrors.ErrParamInvalid,
    fmt.Sprintf("failed to parse gitlab url: %s", err))
    Severity: Major
    Found in pkg/git/gitlab/gitlab.go - About 35 mins to fix

      Method OauthManager.checkRefreshToken has 5 return statements (exceeds 4 allowed).
      Open

      func (m *OauthManager) checkRefreshToken(ctx context.Context,
      refreshToken, redirectURL string) (*tokenmodels.Token, error) {
      token, err := m.tokenStore.GetByCode(ctx, refreshToken)
      if err != nil {
      if _, ok := perror.Cause(err).(*herrors.HorizonErrNotFound); ok {
      Severity: Major
      Found in pkg/oauth/manager/manager.go - About 35 mins to fix

        Method helper.AcceptMR has 5 return statements (exceeds 4 allowed).
        Open

        func (h *helper) AcceptMR(ctx context.Context, pid interface{}, mrID int,
        mergeCommitMsg *string, shouldRemoveSourceBranch *bool) (mr *gitlab.MergeRequest, err error) {
        const op = "gitlab: accept mr"
        defer wlog.Start(ctx, op).StopPrint()
         
         
        Severity: Major
        Found in lib/gitlab/gitlab.go - About 35 mins to fix

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

          func (c *controller) customizeCreateReqBuildTemplateInfo(ctx context.Context, params *CreateClusterParamsV2,
          application *appmodels.Application) (*BuildTemplateInfo, error) {
          buildTemplateInfo := &BuildTemplateInfo{}
          appGitRepoFile, err := c.applicationGitRepo.GetApplication(ctx, application.Name, params.Environment)
          if err != nil {
          Severity: Minor
          Found in core/controller/cluster/controller_basic_v2.go - About 35 mins to fix

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

          func (c *controller) InternalDeploy(ctx context.Context, clusterID uint,
          r *InternalDeployRequest) (_ *InternalDeployResponse, err error) {
          const op = "cluster controller: internal deploy"
          defer wlog.Start(ctx, op).StopPrint()
           
           
          Severity: Minor
          Found in core/controller/cluster/controller_internal.go - About 35 mins to fix

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

          func (c *controller) GetChildren(ctx context.Context, id uint, pageNumber, pageSize int) (
          []*service.Child, int64, error) {
          var parent *models.Group
          var full *service.Full
          if id > 0 {
          Severity: Major
          Found in core/controller/group/controller.go - About 35 mins to fix

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

            func (c *controller) CreateBadge(ctx context.Context, resourceType string,
            resourceID uint, badge *Create) (*Badge, error) {
            if err := c.checkResource(ctx, resourceType, resourceID); err != nil {
            return nil, err
            }
            Severity: Major
            Found in core/controller/badge/controller.go - About 35 mins to fix

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

              func (c *controller) LoginWithPasswd(ctx context.Context, request *LoginRequest) (*models.User, error) {
              users, err := c.userMgr.ListByEmail(ctx, []string{request.Email})
              if err != nil {
              return nil, nil
              }
              Severity: Major
              Found in core/controller/user/controller.go - About 35 mins to fix

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

                func (a *API) CreatePipelineRun(c *gin.Context) {
                op := "cluster: create pipeline run"
                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_basic.go - About 35 mins to fix

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

                  func (a *API) Rollback(c *gin.Context) {
                  op := "cluster: rollback"
                  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 controller.Update has 5 return statements (exceeds 4 allowed).
                    Open

                    func (c *controller) Update(ctx context.Context, resourceType string, resourceID uint, r *UpdateRequest) (err error) {
                    const op = "cluster tag controller: update"
                    defer wlog.Start(ctx, op).StopPrint()
                     
                    tags := r.toTags(resourceType, resourceID)
                    Severity: Major
                    Found in core/controller/tag/controller.go - About 35 mins to fix

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

                      func (c *controller) GetSubGroups(ctx context.Context, id uint, pageNumber, pageSize int) (
                      []*service.Child, int64, error) {
                      var parent *models.Group
                      var full *service.Full
                      if id > 0 {
                      Severity: Major
                      Found in core/controller/group/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) {
                        op := "user: update by id"
                        uid := c.Param(_userIDParam)
                        var (
                        userID uint64
                        Severity: Major
                        Found in core/http/api/v2/user/apis.go - About 35 mins to fix

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

                          func (c *controller) updatePrStatus(ctx context.Context, checkrun *prmodels.CheckRun) error {
                          pipelinerun, err := c.prMgr.PipelineRun.GetByID(ctx, checkrun.PipelineRunID)
                          if err != nil {
                          return err
                          }
                          Severity: Major
                          Found in core/controller/pipelinerun/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 = "application: update v2"
                            var request *application.CreateOrUpdateApplicationRequestV2
                            if err := c.ShouldBindJSON(&request); err != nil {
                            response.AbortWithRPCError(c, rpcerror.ParamError.WithErrMsg(fmt.Sprintf("invalid request body, err: %s",
                            Severity: Major
                            Found in core/http/api/v2/application/apis.go - About 35 mins to fix

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

                              func (a *API) Delete(c *gin.Context) {
                              const op = "application: delete"
                              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

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

                                func parseContext(c *gin.Context) *q.Query {
                                keywords := make(map[string]interface{})
                                 
                                userIDStr := c.Query(common.ClusterQueryByUser)
                                if userIDStr != "" {
                                Severity: Major
                                Found in core/http/api/v2/cluster/apis_basic.go - About 35 mins to fix

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

                                  func (a *API) LoginWithPassword(c *gin.Context) {
                                  var request *user.LoginRequest
                                  if err := c.ShouldBindJSON(&request); err != nil ||
                                  request.Password == "" ||
                                  request.Email == "" {
                                  Severity: Major
                                  Found in core/http/api/v2/user/apis.go - About 35 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language