freqtrade/freqtrade

View on GitHub
freqtrade/optimize/hyperopt.py

Summary

Maintainability
D
1 day
Test Coverage

File hyperopt.py has 498 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# pragma pylint: disable=too-many-instance-attributes, pointless-string-statement

"""
This module contains the hyperopt logic
"""
Severity: Minor
Found in freqtrade/optimize/hyperopt.py - About 7 hrs to fix

    Function generate_optimizer has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def generate_optimizer(self, raw_params: List[Any]) -> Dict[str, Any]:
            """
            Used Optimize function.
            Called once per epoch to optimize whatever is configured.
            Keep this function as optimized as possible!
    Severity: Minor
    Found in freqtrade/optimize/hyperopt.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 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def __init__(self, config: Config) -> None:
            self.buy_space: List[Dimension] = []
            self.sell_space: List[Dimension] = []
            self.protection_space: List[Dimension] = []
            self.roi_space: List[Dimension] = []
    Severity: Minor
    Found in freqtrade/optimize/hyperopt.py - About 1 hr to fix

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

          def _get_params_details(self, params: Dict) -> Dict:
              """
              Return the params for each space
              """
              result: Dict = {}
      Severity: Minor
      Found in freqtrade/optimize/hyperopt.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 _get_results_dict has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def _get_results_dict(self, backtesting_results, min_date, max_date,
      Severity: Minor
      Found in freqtrade/optimize/hyperopt.py - About 45 mins to fix

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

            def init_spaces(self):
                """
                Assign the dimensions in the hyperoptimization space.
                """
                if HyperoptTools.has_space(self.config, 'protection'):
        Severity: Minor
        Found in freqtrade/optimize/hyperopt.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

        There are no issues that match your filters.

        Category
        Status