thinkoner/thinkgo

View on GitHub

Showing 8 of 16 total issues

RedisStore has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

type RedisStore struct {
    pool   *redis.Pool // redis connection pool
    tagSet *TagSet
    prefix string
}
Severity: Minor
Found in cache/redis_store.go - About 2 hrs to fix

    Route has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

    type Route struct {
        inited bool
    
        method      []string
        prefix      string
    Severity: Minor
    Found in router/route.go - About 2 hrs to fix

      Request has 22 methods (exceeds 20 allowed). Consider refactoring.
      Open

      type Request struct {
          Request       *http.Request
          method        string
          path          string
          query         map[string]string
      Severity: Minor
      Found in context/request.go - About 2 hrs to fix

        Method Cookie.Set has 54 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (c *Cookie) Set(name interface{}, params ...interface{}) (*http.Cookie, error) {
            var cookie *http.Cookie
        
            switch name.(type) {
            case *http.Cookie:
        Severity: Minor
        Found in context/cookie.go - About 1 hr to fix

          Method Cookie.Set has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
          Open

          func (c *Cookie) Set(name interface{}, params ...interface{}) (*http.Cookie, error) {
              var cookie *http.Cookie
          
              switch name.(type) {
              case *http.Cookie:
          Severity: Minor
          Found in context/cookie.go - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method Cookie.Set has 7 return statements (exceeds 4 allowed).
          Open

          func (c *Cookie) Set(name interface{}, params ...interface{}) (*http.Cookie, error) {
              var cookie *http.Cookie
          
              switch name.(type) {
              case *http.Cookie:
          Severity: Major
          Found in context/cookie.go - About 45 mins to fix

            Method RedisStore.Flush has 5 return statements (exceeds 4 allowed).
            Open

            func (s *RedisStore) Flush() error {
                if s.tagSet != nil {
                    err := s.deleteForeverKeys()
                    if err != nil {
                        return err
            Severity: Major
            Found in cache/redis_store.go - About 35 mins to fix

              Method RedisStore.deleteKeysByReference has 5 return statements (exceeds 4 allowed).
              Open

              func (s *RedisStore) deleteKeysByReference(reference string) error {
                  if s.tagSet == nil {
                      return nil
                  }
              
              
              Severity: Major
              Found in cache/redis_store.go - About 35 mins to fix
                Severity
                Category
                Status
                Source
                Language