rueian/rueidis

View on GitHub

Showing 130 of 649 total issues

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

func (b Builder) Xack() (c Xack) {
    c = Xack{cs: get(), ks: b.ks}
    c.cs.s = append(c.cs.s, "XACK")
    return c
}
Severity: Minor
Found in internal/cmds/gen_stream.go - About 2 hrs to fix

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

    type FtSearchNostopwords Incomplete
    Severity: Minor
    Found in internal/cmds/gen_search.go - About 2 hrs to fix

      Method locker.try has 84 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (m *locker) try(ctx context.Context, cancel context.CancelFunc, name string, g *gate) context.CancelFunc {
          var err error
      
          val := random()
          deadline := time.Now().Add(m.validity)
      Severity: Major
      Found in rueidislock/lock.go - About 2 hrs to fix

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

        type FtSearchWithscores Incomplete
        Severity: Minor
        Found in internal/cmds/gen_search.go - About 2 hrs to fix

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

          func (b Builder) Blmove() (c Blmove) {
              c = Blmove{cs: get(), ks: b.ks, cf: int16(blockTag)}
              c.cs.s = append(c.cs.s, "BLMOVE")
              return c
          }
          Severity: Minor
          Found in internal/cmds/gen_list.go - About 2 hrs to fix

            Method lru.Flights has 82 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (c *lru) Flights(now time.Time, multi []CacheableTTL, results []RedisResult, entries map[int]CacheEntry) (missed []int) {
                var moves []*list.Element
            
                c.mu.RLock()
                for i, ct := range multi {
            Severity: Major
            Found in lru.go - About 2 hrs to fix

              File gen_cluster.go has 507 lines of code (exceeds 500 allowed). Consider refactoring.
              Open

              // Code generated DO NOT EDIT
              
              package cmds
              
              import "strconv"
              Severity: Minor
              Found in internal/cmds/gen_cluster.go - About 2 hrs to fix

                Builder has 21 methods (exceeds 20 allowed). Consider refactoring.
                Open

                func (b Builder) Append() (c Append) {
                    c = Append{cs: get(), ks: b.ks}
                    c.cs.s = append(c.cs.s, "APPEND")
                    return c
                }
                Severity: Minor
                Found in internal/cmds/gen_string.go - About 2 hrs to fix

                  FtSearchWithpayloads has 21 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  type FtSearchWithpayloads Incomplete
                  Severity: Minor
                  Found in internal/cmds/gen_search.go - About 2 hrs to fix

                    sentinelClient has 21 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    type sentinelClient struct {
                        mConn     atomic.Value
                        sConn     conn
                        mOpt      *ClientOption
                        sOpt      *ClientOption
                    Severity: Minor
                    Found in sentinel.go - About 2 hrs to fix

                      TsMrevrangeTotimestamp has 21 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      type TsMrevrangeTotimestamp Incomplete
                      Severity: Minor
                      Found in internal/cmds/gen_timeseries.go - About 2 hrs to fix

                        TsMrangeTotimestamp has 21 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        type TsMrangeTotimestamp Incomplete
                        Severity: Minor
                        Found in internal/cmds/gen_timeseries.go - About 2 hrs to fix

                          Method pipe.DoMultiCache has 78 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (p *pipe) DoMultiCache(ctx context.Context, multi ...CacheableTTL) *redisresults {
                              if p.cache == nil {
                                  commands := make([]Completed, len(multi))
                                  for i, ct := range multi {
                                      commands[i] = Completed(ct.Cmd)
                          Severity: Major
                          Found in pipe.go - About 2 hrs to fix

                            File gen_bitmap.go has 504 lines of code (exceeds 500 allowed). Consider refactoring.
                            Open

                            // Code generated DO NOT EDIT
                            
                            package cmds
                            
                            import "strconv"
                            Severity: Minor
                            Found in internal/cmds/gen_bitmap.go - About 2 hrs to fix

                              Function ParseURL has 77 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func ParseURL(str string) (opt ClientOption, err error) {
                                  u, err := url.Parse(str)
                                  if err != nil {
                                      return opt, err
                                  }
                              Severity: Major
                              Found in url.go - About 2 hrs to fix

                                Method clusterClient._pickMulti has 73 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func (c *clusterClient) _pickMulti(multi []Completed) (retries *connretry, last uint16, toReplica bool) {
                                    last = cmds.InitSlot
                                    init := false
                                
                                    for _, cmd := range multi {
                                Severity: Minor
                                Found in cluster.go - About 1 hr to fix

                                  Method Client.Get has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
                                  Open

                                  func (c *Client) Get(ctx context.Context, ttl time.Duration, key string, fn func(ctx context.Context, key string) (val string, err error)) (string, error) {
                                      ctx, cancel := context.WithTimeout(ctx, ttl)
                                      defer cancel()
                                  retry:
                                      wait := c.register(key)
                                  Severity: Minor
                                  Found in rueidisaside/aside.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 RedisMessage.AsFtSearch has 69 lines of code (exceeds 50 allowed). Consider refactoring.
                                  Open

                                  func (m *RedisMessage) AsFtSearch() (total int64, docs []FtSearchDoc, err error) {
                                      if err = m.Error(); err != nil {
                                          return 0, nil, err
                                      }
                                      if m.IsMap() {
                                  Severity: Minor
                                  Found in message.go - About 1 hr to fix

                                    Method sentinelClient.listWatch has 69 lines of code (exceeds 50 allowed). Consider refactoring.
                                    Open

                                    func (c *sentinelClient) listWatch(cc conn) (target string, sentinels []string, err error) {
                                        ctx := context.Background()
                                        sentinelsCMD := c.cmd.SentinelSentinels().Master(c.mOpt.Sentinel.MasterSet).Build()
                                        getMasterCMD := c.cmd.SentinelGetMasterAddrByName().Master(c.mOpt.Sentinel.MasterSet).Build()
                                        replicasCMD := c.cmd.SentinelReplicas().Master(c.mOpt.Sentinel.MasterSet).Build()
                                    Severity: Minor
                                    Found in sentinel.go - About 1 hr to fix

                                      Method clusterClient._pickMultiCache has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
                                      Open

                                      func (c *clusterClient) _pickMultiCache(multi []CacheableTTL) *connretrycache {
                                          c.mu.RLock()
                                          defer c.mu.RUnlock()
                                      
                                          count := conncountp.Get(len(c.conns), len(c.conns))
                                      Severity: Minor
                                      Found in cluster.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language