etehtsea/oxblood

View on GitHub

Showing 10 of 130 total issues

Method client_kill has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def client_kill(opts_or_addr = {})
        if opts_or_addr.is_a?(String)
          run(:CLIENT, :KILL, opts_or_addr)
        else
          args = [:CLIENT, :KILL]
Severity: Minor
Found in lib/oxblood/commands/server.rb - 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 parse has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def parse(io)
        line = io.gets(TERMINATOR)

        case line[0]
        when SIMPLE_STRING
Severity: Minor
Found in lib/oxblood/protocol.rb - About 1 hr to fix

    Method parse has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

          def parse(io)
            line = io.gets(TERMINATOR)
    
            case line[0]
            when SIMPLE_STRING
    Severity: Minor
    Found in lib/oxblood/protocol.rb - 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 georadius has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def georadius(key, longitude, latitude, radius, unit, opts = {})
    Severity: Minor
    Found in lib/oxblood/commands/geo.rb - About 45 mins to fix

      Method georadiusbymember has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def georadiusbymember(key, member, radius, unit, opts = {})
      Severity: Minor
      Found in lib/oxblood/commands/geo.rb - About 35 mins to fix

        Method common_range has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def common_range(command_name, key, start, stop, opts)
        Severity: Minor
        Found in lib/oxblood/commands/sorted_sets.rb - About 35 mins to fix

          Method common_rangebyscore has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def common_rangebyscore(command_name, key, min, max, opts)
          Severity: Minor
          Found in lib/oxblood/commands/sorted_sets.rb - About 35 mins to fix

            Method common_store has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def common_store(command_name, destination, numkeys, *keys, **opts)
            Severity: Minor
            Found in lib/oxblood/commands/sorted_sets.rb - About 35 mins to fix

              Method common_rangebylex has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                    def common_rangebylex(command_name, key, min, max, opts)
              Severity: Minor
              Found in lib/oxblood/commands/sorted_sets.rb - About 35 mins to fix

                Method add_georadius_opts! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                      def add_georadius_opts!(args, opts)
                        args << :WITHCOORD if opts[:withcoord]
                        args << :WITHDIST if opts[:withdist]
                        args << :WITHHASH if opts[:withhash]
                
                
                Severity: Minor
                Found in lib/oxblood/commands/geo.rb - About 35 mins 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