Showing 32 of 96 total issues

File client.py has 580 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
Cluster Supporting Redis Client

"""
import collections
Severity: Major
Found in tredis/client.py - About 1 day to fix

    File strings.py has 535 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """Redis String Commands Mixin"""
    
    # Python 2 support for ascii()
    if 'ascii' not in dir(__builtins__):  # pragma: nocover
        from tredis.compat import ascii
    Severity: Major
    Found in tredis/strings.py - About 1 day to fix

      File keys.py has 527 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """Redis Key Commands Mixin"""
      from tornado import concurrent
      
      # Python 2 support for ascii()
      if 'ascii' not in dir(__builtins__):  # pragma: nocover
      Severity: Major
      Found in tredis/keys.py - About 1 day to fix

        File keys_tests.py has 523 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import logging
        import mock
        import os
        import time
        import uuid
        Severity: Major
        Found in tests/keys_tests.py - About 1 day to fix

          StringTests has 50 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class StringTests(base.AsyncTestCase):
          
              @testing.gen_test
              def test_append(self):
                  key, value1, value2 = self.uuid4(3)
          Severity: Minor
          Found in tests/strings_tests.py - About 7 hrs to fix

            File strings_tests.py has 418 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            from tornado import gen
            from tornado import testing
            
            import tredis
            
            
            Severity: Minor
            Found in tests/strings_tests.py - About 6 hrs to fix

              KeyCommandTests has 44 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class KeyCommandTests(base.AsyncTestCase):
              
                  @testing.gen_test
                  def test_delete(self):
                      key, value = self.uuid4(2)
              Severity: Minor
              Found in tests/keys_tests.py - About 6 hrs to fix

                File sets.py has 307 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                """Redis Set Commands Mixin"""
                from tornado import concurrent
                
                # Python 2 support for ascii()
                if 'ascii' not in dir(__builtins__):  # pragma: nocover
                Severity: Minor
                Found in tredis/sets.py - About 3 hrs to fix

                  SetTests has 25 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class SetTests(base.AsyncTestCase):
                  
                      @testing.gen_test
                      def test_sadd_single(self):
                          key, value = self.uuid4(2)
                  Severity: Minor
                  Found in tests/sets_tests.py - About 2 hrs to fix

                    KeysMixin has 24 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class KeysMixin(object):
                        """Redis Key Commands Mixin"""
                    
                        def delete(self, *keys):
                            """Removes the specified keys. A key is ignored if it does not exist.
                    Severity: Minor
                    Found in tredis/keys.py - About 2 hrs to fix

                      StringsMixin has 23 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class StringsMixin(object):
                          """Redis String Commands Mixin"""
                      
                          def append(self, key, value):
                              """If key already exists and is a string, this command appends the
                      Severity: Minor
                      Found in tredis/strings.py - About 2 hrs to fix

                        File sortedsets.py has 258 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        """Redis Sorted Set Commands Mixin"""
                        
                        
                        class SortedSetsMixin(object):
                            """Redis Sorted Set Commands Mixin"""
                        Severity: Minor
                        Found in tredis/sortedsets.py - About 2 hrs to fix

                          Function _on_connected has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def _on_connected(self, future):
                                  """Invoked when connections have been established. If the client is
                                  in clustering mode, it will kick of the discovery step if needed. If
                                  not, it will select the configured database.
                          
                          
                          Severity: Minor
                          Found in tredis/client.py - 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

                          Function cluster_nodes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def cluster_nodes(self):
                                  """Each node in a Redis Cluster has its view of the current cluster
                                  configuration, given by the set of known nodes, the state of the
                                  connection we have with such nodes, their flags, properties and
                                  assigned slots, and so forth.
                          Severity: Minor
                          Found in tredis/cluster.py - 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

                          Function _read has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def _read(self, command, future):
                                  """Invoked when a command is executed to read and parse its results.
                                  It will loop on the IOLoop until the response is complete and then
                                  set the value of the response in the execution future.
                          
                          
                          Severity: Minor
                          Found in tredis/client.py - 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

                          Function sort has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def sort(self,
                                       key,
                                       by=None,
                                       external=None,
                                       offset=0,
                          Severity: Minor
                          Found in tredis/keys.py - 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

                          Function _execute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def _execute(self, parts, expectation=None, format_callback=None):
                                  """Really execute a redis command
                          
                                  :param list parts: The list of command parts
                                  :param mixed expectation: Optional response expectation
                          Severity: Minor
                          Found in tredis/client.py - 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

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

                              def __init__(self,
                          Severity: Major
                          Found in tredis/client.py - About 1 hr to fix

                            Function parse_info_value has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def parse_info_value(value):
                                """
                            
                                :param value:
                                :return:
                            Severity: Minor
                            Found in tredis/common.py - 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

                            Function sort has 8 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def sort(self,
                            Severity: Major
                            Found in tredis/keys.py - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language