horizoncd/horizon

View on GitHub

Showing 440 of 677 total issues

Method controller.UpdateCluster has 141 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (c *controller) UpdateCluster(ctx context.Context, clusterID uint,
r *UpdateClusterRequest, mergePatch bool) (_ *GetClusterResponse, err error) {
const op = "cluster controller: update cluster"
defer wlog.Start(ctx, op).StopPrint()
 
 
Severity: Major
Found in core/controller/cluster/controller_basic.go - About 4 hrs to fix

    Method controller.InternalDeployV2 has 139 lines of code (exceeds 50 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: Major
    Found in core/controller/cluster/controller_internal_v2.go - About 4 hrs to fix

      Method clusterGitopsRepo.GetCluster has a Cognitive Complexity of 45 (exceeds 20 allowed). Consider refactoring.
      Open

      func (g *clusterGitopsRepo) GetCluster(ctx context.Context,
      application, cluster, templateName string) (_ *ClusterFiles, err error) {
      const op = "cluster git repo: get cluster"
      defer wlog.Start(ctx, op).StopPrint()
       
       
      Severity: Minor
      Found in pkg/cluster/gitrepo/gitrepo_cluster.go - About 4 hrs to fix

      Method controller.GetClusterStatus has a Cognitive Complexity of 44 (exceeds 20 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: Minor
      Found in core/controller/cluster/controller_status.go - About 4 hrs to fix

      clusterGitopsRepo has 33 methods (exceeds 20 allowed). Consider refactoring.
      Open

      type clusterGitopsRepo struct {
      gitlabLib gitlablib.Interface
      clustersGroup *gitlab.Group
      recyclingClustersGroup *gitlab.Group
      templateRepo templaterepo.TemplateRepo
      Severity: Minor
      Found in pkg/cluster/gitrepo/gitrepo_cluster.go - About 4 hrs to fix

        File util.go has 588 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 pkg/cd/util.go - About 4 hrs to fix

          File controller_operation.go has 582 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/cluster/controller_operation.go - About 4 hrs to fix

            Method controller.createPipelineRun has 124 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (c *controller) createPipelineRun(ctx context.Context, clusterID uint,
            r *CreatePipelineRunRequest) (*prmodels.Pipelinerun, error) {
            defer wlog.Start(ctx, "cluster controller: create pipeline run").StopPrint()
             
            cluster, err := c.clusterMgr.GetByID(ctx, clusterID)
            Severity: Major
            Found in core/controller/cluster/controller_basic_v2.go - About 3 hrs to fix

              Method controller.GetByFullPath has 124 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (c *controller) GetByFullPath(ctx context.Context,
              resourcePath string, resourceType string) (*service.Child, error) {
              const op = "get record by fullPath"
              defer wlog.Start(ctx, op).StopPrint()
               
               
              Severity: Major
              Found in core/controller/group/controller.go - About 3 hrs to fix

                Function process has a Cognitive Complexity of 42 (exceeds 20 allowed). Consider refactoring.
                Open

                func process(ctx context.Context, jobConfig *autofree.Config, clusterCtr clusterctl.Controller,
                prCtr prctl.Controller) {
                op := "job: cluster auto-free"
                query := &q.Query{
                PageNumber: common.DefaultPageNumber,
                Severity: Minor
                Found in pkg/jobs/autofree/autofree.go - About 3 hrs to fix

                Method controller.CreateClusterV2 has 122 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (c *controller) CreateClusterV2(ctx context.Context,
                params *CreateClusterParamsV2) (*CreateClusterResponseV2, error) {
                const op = "cluster controller: create cluster v2"
                defer wlog.Start(ctx, op).StopPrint()
                 
                 
                Severity: Major
                Found in core/controller/cluster/controller_basic_v2.go - About 3 hrs to fix

                  Method controller.BuildDeploy has 121 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (c *controller) BuildDeploy(ctx context.Context, clusterID uint,
                  r *BuildDeployRequest) (_ *BuildDeployResponse, err error) {
                  const op = "cluster controller: build deploy"
                  defer wlog.Start(ctx, op).StopPrint()
                   
                   
                  Severity: Major
                  Found in core/controller/cluster/controller_build_deploy.go - About 3 hrs to fix

                    Method clusterGitopsRepo.GetCluster has 120 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (g *clusterGitopsRepo) GetCluster(ctx context.Context,
                    application, cluster, templateName string) (_ *ClusterFiles, err error) {
                    const op = "cluster git repo: get cluster"
                    defer wlog.Start(ctx, op).StopPrint()
                     
                     
                    Severity: Major
                    Found in pkg/cluster/gitrepo/gitrepo_cluster.go - About 3 hrs to fix

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

                      func (c *controller) List(ctx context.Context, query *q.Query) (
                      listApplicationResp []*ListApplicationResponse, count int, err error) {
                      const op = "application controller: list application"
                      defer wlog.Start(ctx, op).StopPrint()
                       
                       
                      Severity: Minor
                      Found in core/controller/application/controller.go - About 3 hrs to fix

                      Method clusterGitopsRepo.CreateCluster has 117 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (g *clusterGitopsRepo) CreateCluster(ctx context.Context, params *CreateClusterParams) (err error) {
                      const op = "cluster git repo: create 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 controller.Rollback has 117 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (c *controller) Rollback(ctx context.Context,
                        clusterID uint, r *RollbackRequest) (_ *PipelinerunIDResponse, err error) {
                        const op = "cluster controller: rollback"
                        defer wlog.Start(ctx, op).StopPrint()
                         
                         
                        Severity: Major
                        Found in core/controller/cluster/controller_operation.go - About 3 hrs to fix

                          Method Cleaner.eventNeedClean has a Cognitive Complexity of 39 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (c *Cleaner) eventNeedClean(ctx context.Context, event *models.Event, current time.Time) bool {
                          rules := c.eventRules[event.EventType]
                          for _, rule := range rules {
                          if current.Before(event.CreatedAt.Add(rule.TTL)) {
                          continue
                          Severity: Minor
                          Found in pkg/jobs/clean/cleaner.go - About 3 hrs to fix

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

                          func (c *controller) createPipelineRun(ctx context.Context, clusterID uint,
                          r *CreatePipelineRunRequest) (*prmodels.Pipelinerun, error) {
                          defer wlog.Start(ctx, "cluster controller: create pipeline run").StopPrint()
                           
                          cluster, err := c.clusterMgr.GetByID(ctx, clusterID)
                          Severity: Minor
                          Found in core/controller/cluster/controller_basic_v2.go - About 3 hrs to fix

                          Method controller.Deploy has 110 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (c *controller) Deploy(ctx context.Context, clusterID uint,
                          r *DeployRequest) (_ *PipelinerunIDResponse, err error) {
                          const op = "cluster controller: deploy"
                          defer wlog.Start(ctx, op).StopPrint()
                           
                           
                          Severity: Major
                          Found in core/controller/cluster/controller_operation.go - About 3 hrs to fix

                            Method appGitopsRepo.CreateOrUpdateApplication has 108 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (g appGitopsRepo) CreateOrUpdateApplication(ctx context.Context,
                            application string, req CreateOrUpdateRequest) error {
                            const op = "gitlab repo: create or update application"
                            defer wlog.Start(ctx, op).StopPrint()
                             
                             
                            Severity: Major
                            Found in pkg/application/gitrepo/gitrepo_applicationv2.go - About 3 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language