rueian/rueidis

View on GitHub

Showing 130 of 649 total issues

Method pipe.DoMultiCache has a Cognitive Complexity of 47 (exceeds 20 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: Minor
Found in pipe.go - About 4 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 35 methods (exceeds 20 allowed). Consider refactoring.
Open

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

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

    func (p *pipe) _backgroundWrite() (err error) {
        var (
            ones  = make([]Completed, 1)
            multi []Completed
            ch    chan RedisResult
    Severity: Minor
    Found in pipe.go - About 4 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

    Method RedisMessage.AsFtSearch has a Cognitive Complexity of 45 (exceeds 20 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 4 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

    clusterClient has 34 methods (exceeds 20 allowed). Consider refactoring.
    Open

    type clusterClient struct {
        pslots [16384]conn
        rslots []conn
        opt    *ClientOption
        rOpt   *ClientOption
    Severity: Minor
    Found in cluster.go - About 4 hrs to fix

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

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

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

        func (p *pipe) doCacheMGet(ctx context.Context, cmd Cacheable, ttl time.Duration) RedisResult {
            commands := cmd.Commands()
            keys := len(commands) - 1
            builder := cmds.NewBuilder(cmds.InitSlot)
            result := RedisResult{val: RedisMessage{typ: '*', values: nil}}
        Severity: Minor
        Found in pipe.go - About 3 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 30 methods (exceeds 20 allowed). Consider refactoring.
        Open

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

          Method clusterClient._refresh has 115 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (c *clusterClient) _refresh() (err error) {
              c.mu.RLock()
              results := make(chan clusterslots, len(c.conns))
              pending := make([]conn, 0, len(c.conns))
              if c.aws {
          Severity: Major
          Found in cluster.go - About 3 hrs to fix

            FtSearchQuery has 26 methods (exceeds 20 allowed). Consider refactoring.
            Open

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

              Method clusterClient._pickMulti has a Cognitive Complexity of 36 (exceeds 20 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 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 25 methods (exceeds 20 allowed). Consider refactoring.
              Open

              func (b Builder) FtAggregate() (c FtAggregate) {
                  c = FtAggregate{cs: get(), ks: b.ks, cf: int16(readonly)}
                  c.cs.s = append(c.cs.s, "FT.AGGREGATE")
                  return c
              }
              Severity: Minor
              Found in internal/cmds/gen_search.go - About 2 hrs to fix

                pipe has 25 methods (exceeds 20 allowed). Consider refactoring.
                Open

                type pipe struct {
                    conn            net.Conn
                    error           atomic.Value
                    clhks           atomic.Value // closed hook, invoked after the conn is closed
                    pshks           atomic.Value // pubsub hook, registered by the SetPubSubHooks
                Severity: Minor
                Found in pipe.go - About 2 hrs to fix

                  FtSearchNocontent has 25 methods (exceeds 20 allowed). Consider refactoring.
                  Open

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

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

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

                      mux has 25 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      type mux struct {
                          init   wire
                          dead   wire
                          clhks  atomic.Value
                          dpool  *pool
                      Severity: Minor
                      Found in mux.go - About 2 hrs to fix

                        Method pipe.doCacheMGet has 92 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (p *pipe) doCacheMGet(ctx context.Context, cmd Cacheable, ttl time.Duration) RedisResult {
                            commands := cmd.Commands()
                            keys := len(commands) - 1
                            builder := cmds.NewBuilder(cmds.InitSlot)
                            result := RedisResult{val: RedisMessage{typ: '*', values: nil}}
                        Severity: Major
                        Found in pipe.go - About 2 hrs to fix

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

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

                            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

                              Severity
                              Category
                              Status
                              Source
                              Language