View on GitHub

Showing 3 of 8 total issues

File filters.py has 271 lines of code (exceeds 250 allowed). Consider refactoring.

#     Copyright (C) 2018  Michael Chu

#     This program is free software: you can redistribute it and/or modify
#     it under the terms of the GNU General Public License as published by
#     the Free Software Foundation, either version 3 of the License, or
Severity: Minor
Found in optopsy/filters.py - About 2 hrs to fix

    Consider simplifying this complex logical expression.

        if (
            "leg1_delta" in f
            and "leg2_delta" in f
            and "leg3_delta" in f
            and "leg4_delta" in f
    Severity: Major
    Found in optopsy/checks.py - About 1 hr to fix

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

      def calc_stats(data, fil=None, transpose=False, round=2):
          if data is not None:
              results = {
                  "Profit": total_profit(data),
                  "Win Rate": calc_win_rate(data),
      Severity: Minor
      Found in optopsy/statistics.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