batazor/go-auth

View on GitHub
handlers/user/user.go

Summary

Maintainability
A
1 hr
Test Coverage

Function Create has 6 return statements (exceeds 4 allowed).
Open

func Create(w http.ResponseWriter, r *http.Request) {
    w.Header().Set("Content-Type", "application/json")

    parent := opentracing.GlobalTracer().StartSpan("POST /users")
    defer parent.Finish()
Severity: Major
Found in handlers/user/user.go - About 40 mins to fix

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

    func Update(w http.ResponseWriter, r *http.Request) {
        w.Header().Set("Content-Type", "application/json")
    
        parent := opentracing.GlobalTracer().StartSpan("PUT /users")
        defer parent.Finish()
    Severity: Major
    Found in handlers/user/user.go - About 35 mins to fix

      exported function Create should have comment or be unexported
      Open

      func Create(w http.ResponseWriter, r *http.Request) {
      Severity: Minor
      Found in handlers/user/user.go by golint

      var userId should be userID
      Open

          var userId = chi.URLParam(r, "userId")
      Severity: Minor
      Found in handlers/user/user.go by golint

      exported function Update should have comment or be unexported
      Open

      func Update(w http.ResponseWriter, r *http.Request) {
      Severity: Minor
      Found in handlers/user/user.go by golint

      exported function List should have comment or be unexported
      Open

      func List(w http.ResponseWriter, r *http.Request) {
      Severity: Minor
      Found in handlers/user/user.go by golint

      don't use underscores in Go names; var is_err should be isErr
      Open

          is_err := CheckUniqueUser(w, user)
      Severity: Minor
      Found in handlers/user/user.go by golint

      exported function Delete should have comment or be unexported
      Open

      func Delete(w http.ResponseWriter, r *http.Request) {
      Severity: Minor
      Found in handlers/user/user.go by golint

      var userId should be userID
      Open

          var userId = chi.URLParam(r, "userId")
      Severity: Minor
      Found in handlers/user/user.go by golint

      There are no issues that match your filters.

      Category
      Status