batazor/go-auth

View on GitHub
handlers/session/session.go

Summary

Maintainability
A
1 hr
Test Coverage

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

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

    b, err := ioutil.ReadAll(r.Body)
    defer r.Body.Close()
Severity: Major
Found in handlers/session/session.go - About 40 mins to fix

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

    func Recovery(w http.ResponseWriter, r *http.Request) {
        w.Header().Set("Content-Type", "application/json")
    
        b, err := ioutil.ReadAll(r.Body)
        defer r.Body.Close()
    Severity: Major
    Found in handlers/session/session.go - About 35 mins to fix

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

      func Login(w http.ResponseWriter, r *http.Request) {
          w.Header().Set("Content-Type", "application/json")
      
          b, err := ioutil.ReadAll(r.Body)
          defer r.Body.Close()
      Severity: Major
      Found in handlers/session/session.go - About 35 mins to fix

        exported function Registration should have comment or be unexported
        Open

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

        exported function Logout should have comment or be unexported
        Open

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

        var userId should be userID
        Open

            userId, _ := sessionModel.GetValueByKey(user.RecoveryToken)
        Severity: Minor
        Found in handlers/session/session.go by golint

        exported function RecoveryByToken should have comment or be unexported
        Open

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

        don't use ALL_CAPS in Go names; use CamelCase
        Open

            var TOKEN_REFRESH = r.Header.Get("Authorization")
        Severity: Minor
        Found in handlers/session/session.go by golint

        exported function Recovery should have comment or be unexported
        Open

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

        exported function Debug should have comment or be unexported
        Open

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

        exported function Login should have comment or be unexported
        Open

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

        exported function Refresh should have comment or be unexported
        Open

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

        There are no issues that match your filters.

        Category
        Status