rueian/rueidis

View on GitHub

Showing 635 of 649 total issues

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

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

    Method pipe.DoMultiStream has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring.
    Open

    func (p *pipe) DoMultiStream(ctx context.Context, pool *pool, multi ...Completed) MultiRedisResultStream {
        for _, cmd := range multi {
            cmds.CompletedCS(cmd).Verify()
        }
    
    
    Severity: Minor
    Found in pipe.go - About 2 hrs 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

    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

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                    if dlOk {
                                        if p.timeout > 0 {
                                            defaultDeadline := time.Now().Add(p.timeout)
                                            if dl.After(defaultDeadline) {
                                                dl = defaultDeadline
                                Severity: Major
                                Found in pipe.go and 1 other location - About 2 hrs to fix
                                pipe.go on lines 1114..1132

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 195.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                        if ok {
                                            if p.timeout > 0 {
                                                defaultDeadline := time.Now().Add(p.timeout)
                                                if dl.After(defaultDeadline) {
                                                    dl = defaultDeadline
                                Severity: Major
                                Found in pipe.go and 1 other location - About 2 hrs to fix
                                pipe.go on lines 1183..1201

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 195.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                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
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language