freqtrade/freqtrade

View on GitHub
freqtrade/plot/plotting.py

Summary

Maintainability
D
2 days
Test Coverage

File plotting.py has 597 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logging
from datetime import datetime, timezone
from pathlib import Path
from typing import Dict, List, Optional

Severity: Major
Found in freqtrade/plot/plotting.py - About 1 day to fix

    Function add_indicators has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def add_indicators(fig, row, indicators: Dict[str, Dict], data: pd.DataFrame) -> make_subplots:
        """
        Generate all the indicators selected by the user for a specific row, based on the configuration
        :param fig: Plot figure to append to
        :param row: row number for this plot
    Severity: Minor
    Found in freqtrade/plot/plotting.py - About 2 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 init_plotscript has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def init_plotscript(config, markets: List, startup_candles: int = 0):
        """
        Initialize objects needed for plotting
        :return: Dict with candle (OHLCV) data, trades and pairs
        """
    Severity: Minor
    Found in freqtrade/plot/plotting.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 generate_candlestick_graph has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def generate_candlestick_graph(
    Severity: Major
    Found in freqtrade/plot/plotting.py - About 50 mins to fix

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

      def plot_area(fig, row: int, data: pd.DataFrame, indicator_a: str,
      Severity: Major
      Found in freqtrade/plot/plotting.py - About 50 mins to fix

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

        def add_max_drawdown(fig, row, trades: pd.DataFrame, df_comb: pd.DataFrame,
        Severity: Minor
        Found in freqtrade/plot/plotting.py - About 45 mins to fix

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

          def generate_profit_graph(pairs: str, data: Dict[str, pd.DataFrame],
          Severity: Minor
          Found in freqtrade/plot/plotting.py - About 45 mins to fix

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

            def add_profit(fig, row, data: pd.DataFrame, column: str, name: str) -> make_subplots:
            Severity: Minor
            Found in freqtrade/plot/plotting.py - About 35 mins to fix

              There are no issues that match your filters.

              Category
              Status