horizoncd/horizon

View on GitHub
core/middleware/prehandle/prehandle.go

Summary

Maintainability
D
2 days
Test Coverage

Showing 9 of 9 total issues

Avoid deeply nested control flow statements.
Open

if authRecord.SubResource == common.AliasTemplateRelease &&
len(requestInfo.Parts) == 5 && requestInfo.Parts[4] == pathReleaseSchema {
handleGetSchema(c, mgr, r, authRecord, requestInfo)
return
}
Severity: Major
Found in core/middleware/prehandle/prehandle.go - About 45 mins to fix

    Function handleGetSchema has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func handleGetSchema(c *gin.Context, mgr *managerparam.Manager, r *gin.Engine,
    authRecord auth.AttributesRecord, requestInfo *auth.RequestInfo) {
    Severity: Minor
    Found in core/middleware/prehandle/prehandle.go - About 35 mins to fix

      Function handleCluster has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func handleCluster(c *gin.Context, mgr *managerparam.Manager, r *gin.Engine,
      authRecord auth.AttributesRecord, requestInfo *auth.RequestInfo) {
      Severity: Minor
      Found in core/middleware/prehandle/prehandle.go - About 35 mins to fix

        Function handleApplication has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func handleApplication(c *gin.Context, mgr *managerparam.Manager, r *gin.Engine,
        authRecord auth.AttributesRecord, requestInfo *auth.RequestInfo) {
        Severity: Minor
        Found in core/middleware/prehandle/prehandle.go - About 35 mins to fix

          Function handleTemplate has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func handleTemplate(c *gin.Context, mgr *managerparam.Manager, r *gin.Engine,
          authRecord auth.AttributesRecord, requestInfo *auth.RequestInfo) {
          Severity: Minor
          Found in core/middleware/prehandle/prehandle.go - About 35 mins to fix

            Function handleGetSchema has 5 return statements (exceeds 4 allowed).
            Open

            func handleGetSchema(c *gin.Context, mgr *managerparam.Manager, r *gin.Engine,
            authRecord auth.AttributesRecord, requestInfo *auth.RequestInfo) {
            template, err := mgr.TemplateMgr.GetByName(c, authRecord.Name)
            if err != nil {
            if e, ok := perror.Cause(err).(*herrors.HorizonErrNotFound); ok && e.Source == herrors.TemplateInDB {
            Severity: Major
            Found in core/middleware/prehandle/prehandle.go - About 35 mins to fix

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

              func handleTemplate(c *gin.Context, mgr *managerparam.Manager, r *gin.Engine,
              authRecord auth.AttributesRecord, requestInfo *auth.RequestInfo) {
              template, err := mgr.TemplateMgr.GetByName(c, authRecord.Name)
              if err != nil {
              if e, ok := perror.Cause(err).(*herrors.HorizonErrNotFound); ok && e.Source == herrors.TemplateInDB {
              Severity: Major
              Found in core/middleware/prehandle/prehandle.go and 2 other locations - About 5 hrs to fix
              core/middleware/prehandle/prehandle.go on lines 111..135
              core/middleware/prehandle/prehandle.go on lines 137..161

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

              func handleCluster(c *gin.Context, mgr *managerparam.Manager, r *gin.Engine,
              authRecord auth.AttributesRecord, requestInfo *auth.RequestInfo) {
              cluster, err := mgr.ClusterMgr.GetByName(c, authRecord.Name)
              if err != nil {
              if e, ok := perror.Cause(err).(*herrors.HorizonErrNotFound); ok && e.Source == herrors.ClusterInDB {
              Severity: Major
              Found in core/middleware/prehandle/prehandle.go and 2 other locations - About 5 hrs to fix
              core/middleware/prehandle/prehandle.go on lines 111..135
              core/middleware/prehandle/prehandle.go on lines 206..230

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

              func handleApplication(c *gin.Context, mgr *managerparam.Manager, r *gin.Engine,
              authRecord auth.AttributesRecord, requestInfo *auth.RequestInfo) {
              app, err := mgr.ApplicationMgr.GetByName(c, authRecord.Name)
              if err != nil {
              if e, ok := perror.Cause(err).(*herrors.HorizonErrNotFound); ok && e.Source == herrors.ApplicationInDB {
              Severity: Major
              Found in core/middleware/prehandle/prehandle.go and 2 other locations - About 5 hrs to fix
              core/middleware/prehandle/prehandle.go on lines 137..161
              core/middleware/prehandle/prehandle.go on lines 206..230

              There are no issues that match your filters.

              Category
              Status