Heiss/py-datatype-redis

View on GitHub

Showing 12 of 24 total issues

Set has 29 functions (exceeds 20 allowed). Consider refactoring.
Open

class Set(Bitwise):
    """
    Redis set <-> Python set
    """

Severity: Minor
Found in datatype_redis/types/set/set.py - About 3 hrs to fix

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

    class Dict(Base):
        """
        Redis hash <-> Python dict
        """
    
    
    Severity: Minor
    Found in datatype_redis/types/mapping/dict.py - About 2 hrs to fix

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

          def put(self, item, block=True, timeout=None):
              if self.maxsize == 0:
                  self.append(item)
              else:
                  if not block:
      Severity: Minor
      Found in datatype_redis/types/sequence/queue.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 a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(
              self,
              initial=None,
              key=None,
              serializer=None,
      Severity: Minor
      Found in datatype_redis/types/base.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 _merge has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def _merge(self, iterable=None, **kwargs):
              if iterable:
                  try:
                      items = iterable.items()
                  except AttributeError:
      Severity: Minor
      Found in datatype_redis/types/mapping/multiset.py - About 55 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 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self,
      Severity: Major
      Found in datatype_redis/types/mapping/dict.py - About 50 mins to fix

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

            def __init__(
        Severity: Major
        Found in datatype_redis/types/base.py - About 50 mins to fix

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

              def __setitem__(self, i, s):
                  if isinstance(i, slice):
                      start = i.start if i.start is not None else 0
                      stop = i.stop
                  else:
          Severity: Minor
          Found in datatype_redis/types/text/string.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

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

              def __init__(self,
                           initial=None,
                           key=None,
                           serializer=None,
                           client=None,
          Severity: Minor
          Found in datatype_redis/types/mapping/dict.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

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

              def __getitem__(self, i):
                  if isinstance(i, slice):
                      start = i.start if i.start is not None else 0
                      stop = i.stop if i.stop is not None else 0
                      return [self.loads(item, raw=False) for item in self.client.lrange(self.prefixer(self.key), start, stop - 1)]
          Severity: Minor
          Found in datatype_redis/types/sequence/list.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

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

          def default_client():
              global _config
          
              try:
                  _thread.client
          Severity: Minor
          Found in datatype_redis/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

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

          def configure(**kwargs):
              """
              Configure the client and everything in a central place.
              """
              global _config
          Severity: Minor
          Found in datatype_redis/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