horizoncd/horizon

View on GitHub

Showing 676 of 677 total issues

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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    go func() {
                    defer wg.Done()
                    pipelineBytes, err1 = g.gitlabLib.GetFile(ctx, pid, GitOpsBranch, common.GitopsFilePipeline)
                    if err1 != nil {
                    return
                    Severity: Minor
                    Found in pkg/cluster/gitrepo/gitrepo_cluster.go and 1 other location - About 35 mins to fix
                    pkg/cluster/gitrepo/gitrepo_cluster.go on lines 218..228

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    go func() {
                    defer wg.Done()
                    applicationBytes, err2 = g.gitlabLib.GetFile(ctx, pid, GitOpsBranch, common.GitopsFileApplication)
                    if err2 != nil {
                    return
                    Severity: Minor
                    Found in pkg/cluster/gitrepo/gitrepo_cluster.go and 1 other location - About 35 mins to fix
                    pkg/cluster/gitrepo/gitrepo_cluster.go on lines 207..217

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    commitMsg := angular.CommitMessage("cluster", angular.Subject{
                    Operator: currentUser.GetName(),
                    Action: "update cluster",
                    Cluster: angular.StringPtr(params.Cluster),
                    }, struct {
                    Severity: Minor
                    Found in pkg/cluster/gitrepo/gitrepo_cluster.go and 1 other location - About 35 mins to fix
                    pkg/cluster/gitrepo/gitrepo_cluster.go on lines 548..558

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    commitMsg := angular.CommitMessage("cluster", angular.Subject{
                    Operator: currentUser.GetName(),
                    Action: "create cluster",
                    Cluster: angular.StringPtr(params.Cluster),
                    }, struct {
                    Severity: Minor
                    Found in pkg/cluster/gitrepo/gitrepo_cluster.go and 1 other location - About 35 mins to fix
                    pkg/cluster/gitrepo/gitrepo_cluster.go on lines 664..674

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                    func Warning(ctx context.Context, args ...interface{}) {
                    val, ok := ctx.Value(string(traceKey)).(string)
                    if !ok {
                    val = ""
                    }
                    Severity: Major
                    Found in pkg/util/log/log.go and 3 other locations - About 35 mins to fix
                    pkg/util/log/log.go on lines 60..67
                    pkg/util/log/log.go on lines 78..85
                    pkg/util/log/log.go on lines 114..121

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                    if b, err := a.badgeCtl.GetBadgeByName(c, resourceType, resourceID, badgeName); err != nil {
                    if _, ok := perror.Cause(err).(*herrors.HorizonErrNotFound); ok {
                    response.AbortWithRPCError(c, rpcerror.NotFoundError.WithErrMsg(err.Error()))
                    return
                    }
                    Severity: Minor
                    Found in core/http/api/v2/badge/apis.go and 1 other location - About 35 mins to fix
                    core/http/api/v2/badge/apis.go on lines 167..176

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                    func Debug(ctx context.Context, args ...interface{}) {
                    val, ok := ctx.Value(string(traceKey)).(string)
                    if !ok {
                    val = ""
                    }
                    Severity: Major
                    Found in pkg/util/log/log.go and 3 other locations - About 35 mins to fix
                    pkg/util/log/log.go on lines 60..67
                    pkg/util/log/log.go on lines 78..85
                    pkg/util/log/log.go on lines 96..103

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                    func Error(ctx context.Context, args ...interface{}) {
                    val, ok := ctx.Value(string(traceKey)).(string)
                    if !ok {
                    val = ""
                    }
                    Severity: Major
                    Found in pkg/util/log/log.go and 3 other locations - About 35 mins to fix
                    pkg/util/log/log.go on lines 60..67
                    pkg/util/log/log.go on lines 96..103
                    pkg/util/log/log.go on lines 114..121

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                    if b, err := a.badgeCtl.GetBadge(c, uint(badgeID)); err != nil {
                    if _, ok := perror.Cause(err).(*herrors.HorizonErrNotFound); ok {
                    response.AbortWithRPCError(c, rpcerror.NotFoundError.WithErrMsg(err.Error()))
                    return
                    }
                    Severity: Minor
                    Found in core/http/api/v2/badge/apis.go and 1 other location - About 35 mins to fix
                    core/http/api/v2/badge/apis.go on lines 178..187

                    Similar blocks of code found in 4 locations. Consider refactoring.
                    Open

                    func Info(ctx context.Context, args ...interface{}) {
                    val, ok := ctx.Value(string(traceKey)).(string)
                    if !ok {
                    val = ""
                    }
                    Severity: Major
                    Found in pkg/util/log/log.go and 3 other locations - About 35 mins to fix
                    pkg/util/log/log.go on lines 78..85
                    pkg/util/log/log.go on lines 96..103
                    pkg/util/log/log.go on lines 114..121

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    func (c *controller) GetByID(ctx context.Context, id uint) (*Environment, error) {
                    environment, err := c.envMgr.GetByID(ctx, id)
                    if err != nil {
                    return nil, err
                    }
                    Severity: Minor
                    Found in core/controller/environment/controller.go and 1 other location - About 35 mins to fix
                    core/controller/environment/controller.go on lines 68..74
                    Severity
                    Category
                    Status
                    Source
                    Language