horizoncd/horizon

View on GitHub
core/controller/cluster/controller_build_deploy.go

Summary

Maintainability
B
6 hrs
Test Coverage
C
70%

Showing 3 of 3 total issues

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 controller.BuildDeploy has 14 return statements (exceeds 4 allowed).
    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 1 hr to fix

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

      if r.Git != nil {
      if r.Git.Commit != "" {
      gitRefType = codemodels.GitRefTypeCommit
      gitRef = r.Git.Commit
      } else if r.Git.Tag != "" {
      Severity: Major
      Found in core/controller/cluster/controller_build_deploy.go and 1 other location - About 1 hr to fix
      core/controller/cluster/controller_basic_v2.go on lines 727..738
      Category
      Status