batazor/go-auth

View on GitHub

Showing 99 of 99 total issues

Function TestUser has 63 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func TestUser(t *testing.T) {

    ts := httptest.NewServer(r)
    defer ts.Close()

Severity: Minor
Found in handlers/user/user_test.go - About 1 hr to fix

    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 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 VerifyCaptcha has 6 return statements (exceeds 4 allowed).
        Open

        func VerifyCaptcha(captchaResponse []byte) error {
            var captcha Captcha
            err := json.Unmarshal(captchaResponse, &captcha)
            if err != nil {
                return err
        Severity: Major
        Found in utils/recaptcha/recaptcha.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 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

              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

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

                func googleCallback(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/oauth/google.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 CheckRefreshToken should have comment or be unexported
                  Open

                  func CheckRefreshToken(token string) (bool, error) {
                  Severity: Minor
                  Found in models/session/session.go by golint

                  exported function GetValueByKey should have comment or be unexported
                  Open

                  func GetValueByKey(token string) (string, error) {
                  Severity: Minor
                  Found in models/session/session.go by golint

                  exported function Add should have comment or be unexported
                  Open

                  func Add(user User) (error, User) {
                  Severity: Minor
                  Found in models/user/user.go by golint

                  exported method StructuredLoggerEntry.Panic should have comment or be unexported
                  Open

                  func (l *StructuredLoggerEntry) Panic(v interface{}, stack []byte) {
                  Severity: Minor
                  Found in utils/logger.go by golint

                  Line length
                  Open

                  Every release, along with the migration instructions, is documented on the Github [Releases](https://github.com/micro-company/go-auth/releases) page.
                  Severity: Info
                  Found in CHANGELOG.md by markdownlint

                  MD013 - Line length

                  Tags: line_length

                  Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

                  This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

                  This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

                  You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

                  Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

                  exported function NotFoundHandler should have comment or be unexported
                  Open

                  func NotFoundHandler(w http.ResponseWriter, r *http.Request) {
                  Severity: Minor
                  Found in cmd/go-auth/main.go by golint

                  exported function Update should have comment or be unexported
                  Open

                  func Update(user *User) (*User, error) {
                  Severity: Minor
                  Found in models/user/user.go by golint

                  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 VerifyToken should have comment or be unexported
                  Open

                  func VerifyToken(tokenString string) (*jwt.Token, error) {
                  Severity: Minor
                  Found in models/session/session.go by golint

                  exported function NewStructuredLogger should have comment or be unexported
                  Open

                  func NewStructuredLogger(logger *logrus.Logger) func(next http.Handler) http.Handler {
                  Severity: Minor
                  Found in utils/logger.go by golint
                  Severity
                  Category
                  Status
                  Source
                  Language