Showing 32 of 96 total issues

Function migrate has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def migrate(self,
Severity: Major
Found in tredis/keys.py - About 50 mins to fix

    Function _encode_resp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def _encode_resp(self, value):
            """Dynamically build the RESP payload based upon the list provided.
    
            :param mixed value: The list of command parts to encode
            :rtype: bytes
    Severity: Minor
    Found in tredis/client.py - About 45 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

    Function zrangebyscore has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def zrangebyscore(self,
    Severity: Minor
    Found in tredis/sortedsets.py - About 45 mins to fix

      Function set has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def set(self, key, value, ex=None, px=None, nx=False, xx=False):
      Severity: Minor
      Found in tredis/strings.py - About 45 mins to fix

        Function zadd has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def zadd(self, key, *members, **kwargs):
                """Adds all the specified members with the specified scores to the
                sorted set stored at key. It is possible to specify multiple score /
                member pairs. If a specified member is already a member of the sorted
                set, the score is updated and the element reinserted at the right
        Severity: Minor
        Found in tredis/sortedsets.py - About 45 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

        Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self,
        Severity: Minor
        Found in tredis/client.py - About 45 mins to fix

          Function setup_module has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def setup_module():
              try:
                  with open('build/test-environment') as env_file:
                      for line_num, line in enumerate(env_file):
                          if line.startswith('export '):
          Severity: Minor
          Found in tests/__init__.py - About 45 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

          Function expiring_set has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def expiring_set(self, key, value, expiration=None, nx=None, xx=None):
          Severity: Minor
          Found in tests/base.py - About 35 mins to fix

            Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self,
            Severity: Minor
            Found in tredis/client.py - About 35 mins to fix

              Function auth has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def auth(self, password):
                      """Request for authentication in a password-protected Redis server.
                      Redis can be instructed to require a password before allowing clients
                      to execute commands. This is done using the ``requirepass`` directive
                      in the configuration file.
              Severity: Minor
              Found in tredis/server.py - 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

              Avoid too many return statements within this function.
              Open

                          return b''.join(output)
              Severity: Major
              Found in tredis/client.py - About 30 mins to fix

                Function _pick_cluster_host has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _pick_cluster_host(self, value):
                        """Selects the Redis cluster host for the specified value.
                
                        :param mixed value: The value to use when looking for the host
                        :rtype: tredis.client._Connection
                Severity: Minor
                Found in tredis/client.py - About 25 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