horizoncd/horizon

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

Summary

Maintainability
C
1 day
Test Coverage

Showing 5 of 5 total issues

Function akskAuthn has 66 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func akskAuthn(c *gin.Context, keys authenticate.KeysConfig, userMgr usermanager.Manager) (*models.User, error) {
r := c.Request
log.Infof(c, "request url path: %v", r.URL)
 
operator := r.Header.Get(HTTPHeaderOperator)
Severity: Minor
Found in core/middleware/user/user.go - About 1 hr to fix

    Function akskAuthn has 12 return statements (exceeds 4 allowed).
    Open

    func akskAuthn(c *gin.Context, keys authenticate.KeysConfig, userMgr usermanager.Manager) (*models.User, error) {
    r := c.Request
    log.Infof(c, "request url path: %v", r.URL)
     
    operator := r.Header.Get(HTTPHeaderOperator)
    Severity: Major
    Found in core/middleware/user/user.go - About 1 hr to fix

      Function akskAuthn has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
      Open

      func akskAuthn(c *gin.Context, keys authenticate.KeysConfig, userMgr usermanager.Manager) (*models.User, error) {
      r := c.Request
      log.Infof(c, "request url path: %v", r.URL)
       
      operator := r.Header.Get(HTTPHeaderOperator)
      Severity: Minor
      Found in core/middleware/user/user.go - About 25 mins to fix

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

      func SignRequest(ctx context.Context, request *http.Request, publicKey string, secretKey string) string {
      /*
      * StringToSign = HTTP-Verb + "\n" +
      * PATH + "\n" +
      * Content-MD5 + "\n" +
      Severity: Major
      Found in core/middleware/user/user.go and 1 other location - About 4 hrs to fix
      core/middleware/authenticate/authenticate.go on lines 158..188

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

      func validatingContentMD5(ctx context.Context, r *http.Request) error {
      data, err := ioutil.ReadAll(r.Body)
      if err != nil {
      log.Errorf(ctx, err.Error())
      return err
      Severity: Major
      Found in core/middleware/user/user.go and 1 other location - About 3 hrs to fix
      core/middleware/authenticate/authenticate.go on lines 131..156

      There are no issues that match your filters.

      Category
      Status