horizoncd/horizon

View on GitHub

Showing 440 of 677 total issues

Method controller.InternalDeploy has 107 lines of code (exceeds 50 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: Major
Found in core/controller/cluster/controller_internal.go - About 3 hrs to fix

    Method WebhookLogGenerator.Process has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
    Open

    func (w *WebhookLogGenerator) Process(ctx context.Context, events []*models.Event,
    resume bool) error {
    var (
    webhookLogs []*webhookmodels.WebhookLog
    conditionsToCreate = map[uint]map[uint]messageDependency{}
    Severity: Minor
    Found in pkg/eventhandler/wlgenerator/wlgenerator.go - About 3 hrs to fix

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

    func (c *controller) InternalDeployV2(ctx context.Context, clusterID uint,
    r *InternalDeployRequestV2) (_ *InternalDeployResponseV2, err error) {
    const op = "cluster controller: internal deploy v2"
    defer wlog.Start(ctx, op).StopPrint()
     
     
    Severity: Minor
    Found in core/controller/cluster/controller_internal_v2.go - About 3 hrs to fix

    Function Middleware has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
    Open

    func Middleware(param *param.Param, applicationRegionCtl applicationregion.Controller,
    mgr *managerparam.Manager, skippers ...middleware.Skipper) gin.HandlerFunc {
    return middleware.New(func(c *gin.Context) {
    // for request to create cluster, set default region to scope if not provided
    if _createClusterURLPattern.MatchString(c.Request.URL.Path) &&
    Severity: Minor
    Found in core/middleware/scope/scope.go - About 3 hrs to fix

    Method clusterGitopsRepo.UpdateCluster has 102 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (g *clusterGitopsRepo) UpdateCluster(ctx context.Context, params *UpdateClusterParams) error {
    const op = "cluster git repo: update cluster"
    defer wlog.Start(ctx, op).StopPrint()
     
    currentUser, err := common.UserFromContext(ctx)
    Severity: Major
    Found in pkg/cluster/gitrepo/gitrepo_cluster.go - About 3 hrs to fix

      Method dao.List has 101 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (d *dao) List(ctx context.Context, query *q.Query, userID uint,
      withRegion bool, appIDs ...uint) (int, []*models.ClusterWithRegion, error) {
      var (
      clusters []*models.ClusterWithRegion
      total int64
      Severity: Major
      Found in pkg/cluster/dao/dao.go - About 3 hrs to fix

        File apis.go has 542 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        // Copyright © 2023 Horizoncd.
        //
        // Licensed under the Apache License, Version 2.0 (the "License");
        // you may not use this file except in compliance with the License.
        // You may obtain a copy of the License at
        Severity: Minor
        Found in core/http/api/v2/template/apis.go - About 3 hrs to fix

          Method ArgoServer.GetApplicationTree has 100 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (argoServer *ArgoServer) GetApplicationTree(w http.ResponseWriter, r *http.Request) {
          if strings.Contains(r.URL.Path, "notfound") {
          w.WriteHeader(http.StatusNotFound)
          return
          }
          Severity: Major
          Found in pkg/argocd/mock/mock.go - About 3 hrs to fix

            helper has 26 methods (exceeds 20 allowed). Consider refactoring.
            Open

            type helper struct {
            client *gitlab.Client
            httpURL string
            }
            Severity: Minor
            Found in lib/gitlab/gitlab.go - About 3 hrs to fix

              Function parsePod has 99 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func parsePod(ctx context.Context, clusterInfo *ClusterState,
              pod *corev1.Pod, events []*corev1.Event) (err error) {
              const deploymentPodTemplateHash = "pod-template-hash"
              const rolloutPodTemplateHash = "rollouts-pod-template-hash"
               
               
              Severity: Major
              Found in pkg/cd/util.go - About 2 hrs to fix

                Method controller.CreateCluster has 99 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (c *controller) CreateCluster(ctx context.Context, applicationID uint, environment,
                region string, r *CreateClusterRequest, mergePatch bool) (_ *GetClusterResponse, err error) {
                const op = "cluster controller: create cluster"
                defer wlog.Start(ctx, op).StopPrint()
                 
                 
                Severity: Major
                Found in core/controller/cluster/controller_basic.go - About 2 hrs to fix

                  Method controller.GetClusterStatus has 99 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (c *controller) GetClusterStatus(ctx context.Context, clusterID uint) (_ *GetClusterStatusResponse, err error) {
                  const op = "cluster controller: get cluster status"
                  defer wlog.Start(ctx, op).StopPrint()
                   
                  resp := &GetClusterStatusResponse{}
                  Severity: Major
                  Found in core/controller/cluster/controller_status.go - About 2 hrs to fix

                    File controller.go has 535 lines of code (exceeds 500 allowed). Consider refactoring.
                    Open

                    // Copyright © 2023 Horizoncd.
                    //
                    // Licensed under the Apache License, Version 2.0 (the "License");
                    // you may not use this file except in compliance with the License.
                    // You may obtain a copy of the License at
                    Severity: Minor
                    Found in core/controller/group/controller.go - About 2 hrs to fix

                      RegionInformers has 25 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      type RegionInformers struct {
                      regionMgr manager.Manager
                       
                      defaultResync time.Duration
                       
                       
                      Severity: Minor
                      Found in pkg/regioninformers/regioninformers.go - About 2 hrs to fix

                        controller has 25 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        type controller struct {
                        gitgetter git.Helper
                        templateRepo templaterepo.TemplateRepo
                        groupMgr gmanager.Manager
                        templateMgr tmanager.Manager
                        Severity: Minor
                        Found in core/controller/template/controller.go - About 2 hrs to fix

                          controller has 25 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          type controller struct {
                          prMgr *prmanager.PRManager
                          appMgr appmanager.Manager
                          clusterMgr clustermanager.Manager
                          envMgr envmanager.Manager
                          Severity: Minor
                          Found in core/controller/pipelinerun/controller.go - About 2 hrs to fix

                            Method controller.DeleteCluster has 95 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (c *controller) DeleteCluster(ctx context.Context, clusterID uint, hard bool) (err error) {
                            const op = "cluster controller: delete cluster"
                            defer wlog.Start(ctx, op).StopPrint()
                             
                            // get some relevant models
                            Severity: Major
                            Found in core/controller/cluster/controller_basic.go - About 2 hrs to fix

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

                              func (c *controller) LoginOrLink(ctx context.Context,
                              code string, state string, redirectURL string) (*usermodel.User, error) {
                              bts, err := base64.StdEncoding.DecodeString(state)
                              if err != nil {
                              return nil, perror.Wrapf(
                              Severity: Minor
                              Found in core/controller/idp/controller.go - About 2 hrs to fix

                              Method controller.GetClusterV2 has 92 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func (c *controller) GetClusterV2(ctx context.Context, clusterID uint) (*GetClusterResponseV2, error) {
                              const op = "cluster controller: get cluster v2"
                              defer wlog.Start(ctx, op).StopPrint()
                               
                              // 1. get cluster from db
                              Severity: Major
                              Found in core/controller/cluster/controller_basic_v2.go - About 2 hrs to fix

                                File cd.go has 527 lines of code (exceeds 500 allowed). Consider refactoring.
                                Open

                                /*
                                Copyright The Kubernetes Authors.
                                 
                                Licensed under the Apache License, Version 2.0 (the "License");
                                you may not use this file except in compliance with the License.
                                Severity: Minor
                                Found in pkg/cd/cd.go - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language