reegis/scenario_builder

View on GitHub

Showing 15 of 29 total issues

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

"""Create a basic scenario from the internal data structure.

SPDX-FileCopyrightText: 2016-2021 Uwe Krien <krien@uni-bremen.de>

SPDX-License-Identifier: MIT
Severity: Minor
Found in src/scenario_builder/powerplants.py - About 6 hrs to fix

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

    def chp_table(heat_b, heat_demand, table_collection, regions=None):
        """
    
        Parameters
        ----------
    Severity: Minor
    Found in src/scenario_builder/powerplants.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 substract_chp_capacity_and_limit_from_pp has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def substract_chp_capacity_and_limit_from_pp(tc, eta_heat_chp, eta_elec_chp):
        """
    
        Parameters
        ----------
    Severity: Minor
    Found in src/scenario_builder/powerplants.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 get_heat_profiles_deflex has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_heat_profiles_deflex(
        deflex_geo, year, time_index=None, weather_year=None, keep_unit=False
    ):
        """
    
    
    Severity: Minor
    Found in src/scenario_builder/demand.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 create_powerplants has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_powerplants(
        pp, table_collection, year, region_column="deflex_region"
    ):
        """This function works for all power plant tables with an equivalent
        structure e.g. power plants by state or other regions."""
    Severity: Minor
    Found in src/scenario_builder/powerplants.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 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 scenario_elec_demand has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def scenario_elec_demand(
    Severity: Minor
    Found in src/scenario_builder/demand.py - About 45 mins to fix

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

      def scenario_demand(regions, year, name, opsd_version=None, weather_year=None):
      Severity: Minor
      Found in src/scenario_builder/demand.py - About 35 mins to fix

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

        def get_deflex_pp_by_year(
        Severity: Minor
        Found in src/scenario_builder/powerplants.py - About 35 mins to fix

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

          def get_heat_profiles_deflex(
          Severity: Minor
          Found in src/scenario_builder/demand.py - About 35 mins to fix

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

            def scenario_chp(table_collection, regions, year, name, weather_year=None):
            Severity: Minor
            Found in src/scenario_builder/powerplants.py - About 35 mins to fix

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

              def add_additional_values(table_collection):
                  """
              
                  Parameters
                  ----------
              Severity: Minor
              Found in src/scenario_builder/powerplants.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

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

              def add_pp_limit(table_collection, year):
                  """
              
                  Parameters
                  ----------
              Severity: Minor
              Found in src/scenario_builder/powerplants.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

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

              def scenario_mobility(year, table):
                  """
              
                  Parameters
                  ----------
              Severity: Minor
              Found in src/scenario_builder/mobility.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