freqtrade/freqtrade

View on GitHub
freqtrade/data/history/datahandlers/idatahandler.py

Summary

Maintainability
D
1 day
Test Coverage

File idatahandler.py has 426 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
Abstract datahandler interface.
It's subclasses handle and storing data from disk.

"""
Severity: Minor
Found in freqtrade/data/history/datahandlers/idatahandler.py - About 6 hrs to fix

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

    class IDataHandler(ABC):
    
        _OHLCV_REGEX = r'^([a-zA-Z_\d-]+)\-(\d+[a-zA-Z]{1,2})\-?([a-zA-Z_]*)?(?=\.)'
    
        def __init__(self, datadir: Path) -> None:
    Severity: Minor
    Found in freqtrade/data/history/datahandlers/idatahandler.py - About 2 hrs to fix

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

          def _check_empty_df(
                  self, pairdf: DataFrame, pair: str, timeframe: str, candle_type: CandleType,
                  warn_no_data: bool, warn_price: bool = False) -> bool:
              """
              Warn on empty dataframe
      Severity: Minor
      Found in freqtrade/data/history/datahandlers/idatahandler.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 ohlcv_load has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def ohlcv_load(self, pair, timeframe: str,
      Severity: Major
      Found in freqtrade/data/history/datahandlers/idatahandler.py - About 1 hr to fix

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

            def ohlcv_load(self, pair, timeframe: str,
                           candle_type: CandleType, *,
                           timerange: Optional[TimeRange] = None,
                           fill_missing: bool = True,
                           drop_incomplete: bool = False,
        Severity: Minor
        Found in freqtrade/data/history/datahandlers/idatahandler.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 _check_empty_df has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def _check_empty_df(
        Severity: Minor
        Found in freqtrade/data/history/datahandlers/idatahandler.py - About 45 mins to fix

          Function _validate_pairdata has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def _validate_pairdata(self, pair, pairdata: DataFrame, timeframe: str,
          Severity: Minor
          Found in freqtrade/data/history/datahandlers/idatahandler.py - About 45 mins to fix

            Function _pair_data_filename has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def _pair_data_filename(
            Severity: Minor
            Found in freqtrade/data/history/datahandlers/idatahandler.py - About 35 mins to fix

              Function rename_futures_data has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def rename_futures_data(
              Severity: Minor
              Found in freqtrade/data/history/datahandlers/idatahandler.py - About 35 mins to fix

                There are no issues that match your filters.

                Category
                Status