freqtrade/freqtrade

View on GitHub
freqtrade/exchange/exchange_utils.py

Summary

Maintainability
B
6 hrs
Test Coverage

Function price_to_precision has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

def price_to_precision(
    price: float,
    price_precision: Optional[float],
    precisionMode: Optional[int],
    *,
Severity: Minor
Found in freqtrade/exchange/exchange_utils.py - About 3 hrs 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 __price_to_precision_significant_digits has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def __price_to_precision_significant_digits(
    price: float,
    price_precision: float,
    *,
    rounding_mode: int = ROUND,
Severity: Minor
Found in freqtrade/exchange/exchange_utils.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 price_to_precision has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def price_to_precision(
Severity: Minor
Found in freqtrade/exchange/exchange_utils.py - About 35 mins to fix

    Avoid too many return statements within this function.
    Open

                    return floor(ticks) / (10**ndigits)
    Severity: Major
    Found in freqtrade/exchange/exchange_utils.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return price
      Severity: Major
      Found in freqtrade/exchange/exchange_utils.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return __price_to_precision_significant_digits(
        Severity: Major
        Found in freqtrade/exchange/exchange_utils.py - About 30 mins to fix

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

          def validate_exchange(exchange: str) -> Tuple[bool, str]:
              """
              returns: can_use, reason
                  with Reason including both missing and missing_opt
              """
          Severity: Minor
          Found in freqtrade/exchange/exchange_utils.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