oemof/oemof-tools

View on GitHub

Showing 8 of 8 total issues

Function define_logging has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

def define_logging(
Severity: Major
Found in src/oemof/tools/logger.py - About 1 hr to fix

    Function define_logging has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def define_logging(
        logpath=None,
        logfile="oemof.log",
        file_format=None,
        screen_format=None,
    Severity: Minor
    Found in src/oemof/tools/logger.py - About 1 hr to fix

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

      def exec_in_env():
          env_path = join(base_path, ".tox", "bootstrap")
          if sys.platform == "win32":
              bin_path = join(env_path, "Scripts")
          else:
      Severity: Minor
      Found in ci/bootstrap.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 define_logging has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def define_logging(
          logpath=None,
          logfile="oemof.log",
          file_format=None,
          screen_format=None,
      Severity: Minor
      Found in src/oemof/tools/logger.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

      Consider simplifying this complex logical expression.
      Open

          if (
              (n < 1)
              or (wacc < 0 or wacc > 1)
              or (u < 1)
              or (cost_decrease < 0 or cost_decrease > 1)
      Severity: Major
      Found in src/oemof/tools/economics.py - About 40 mins to fix

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

        def annuity(capex, n, wacc, u=None, cost_decrease=0):
        Severity: Minor
        Found in src/oemof/tools/economics.py - About 35 mins to fix

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

          def annuity(capex, n, wacc, u=None, cost_decrease=0):
              r"""Calculates the annuity of an initial investment 'capex', considering
              the cost of capital 'wacc' during a project horizon 'n'
          
              In case of a single initial investment, the employed formula reads:
          Severity: Minor
          Found in src/oemof/tools/economics.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

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

          def main():
              import jinja2
              import matrix
          
              print("Project path: {0}".format(base_path))
          Severity: Minor
          Found in ci/bootstrap.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

          Severity
          Category
          Status
          Source
          Language