dragonchain/dragonchain

View on GitHub
dragonchain/lib/database/redis.py

Summary

Maintainability
B
4 hrs
Test Coverage
B
80%

File redis.py has 269 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2020 Dragonchain, Inc.
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
Severity: Minor
Found in dragonchain/lib/database/redis.py - About 2 hrs to fix

    Function _decode_dict_response has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def _decode_dict_response(response: Mapping[Any, Any], decode: bool) -> Any:
        if decode is True:
            new_response = {}
            for key, value in response.items():
                if isinstance(key, bytes):
    Severity: Minor
    Found in dragonchain/lib/database/redis.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 zadd_sync has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def zadd_sync(name: str, mapping: Dict[str, int], nx: bool = False, xx: bool = False, ch: bool = False, incr: bool = False) -> int:
    Severity: Minor
    Found in dragonchain/lib/database/redis.py - About 45 mins to fix

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

      def _decode_list_response(response: Iterable[Any], decode: bool) -> Any:
          if decode is True:
              new_response = []
              for val in response:
                  if isinstance(val, bytes):
      Severity: Minor
      Found in dragonchain/lib/database/redis.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 _decode_set_response has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def _decode_set_response(response: Iterable[Any], decode: bool) -> Any:
          if decode is True:
              new_response = set()
              for val in response:
                  if isinstance(val, bytes):
      Severity: Minor
      Found in dragonchain/lib/database/redis.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

      There are no issues that match your filters.

      Category
      Status