horizoncd/horizon

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

Summary

Maintainability
C
1 day
Test Coverage
F
56%

Showing 5 of 5 total issues

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 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

    Method controller.InternalDeployV2 has 25 return statements (exceeds 4 allowed).
    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 2 hrs to fix

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

      func (c *controller) retrieveClaimsAndUser(ctx context.Context) (*tokenservice.Claims, *usermodel.User, error) {
      jwtTokenString, err := common.JWTTokenStringFromContext(ctx)
      if err != nil {
      return nil, nil, err
      }
      Severity: Major
      Found in core/controller/cluster/controller_internal_v2.go - About 35 mins to fix

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

        updatePRStatus := func(pState prmodels.PipelineStatus, revision string) error {
        if err = c.prMgr.PipelineRun.UpdateStatusByID(ctx, pr.ID, pState); err != nil {
        log.Errorf(ctx, "UpdateStatusByID error, pr = %d, status = %s, err = %v",
        pr.ID, pState, err)
        return err
        Severity: Minor
        Found in core/controller/cluster/controller_internal_v2.go and 1 other location - About 45 mins to fix
        core/controller/cluster/controller_internal.go on lines 86..95

        There are no issues that match your filters.

        Category
        Status