oemof/oemof-solph

View on GitHub

Showing 139 of 424 total issues

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

    def __init__(
Severity: Minor
Found in src/oemof/solph/components/_offset_converter.py - About 35 mins to fix

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

    def limit_active_flow_count(
    Severity: Minor
    Found in src/oemof/solph/constraints/flow_count_limit.py - About 35 mins to fix

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

          def __init__(
      Severity: Minor
      Found in src/oemof/solph/components/_converter.py - About 35 mins to fix

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

            def __init__(
        Severity: Minor
        Found in src/oemof/solph/components/_link.py - About 35 mins to fix

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

              def __init__(
                  self,
                  label=None,
                  inputs=None,
                  outputs=None,
          Severity: Minor
          Found in src/oemof/solph/components/_converter.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 flatten has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          def flatten(d, parent_key="", sep="_"):
              """
              Flatten dictionary by compressing keys.
          
              See: https://stackoverflow.com/questions/6027558/
          Severity: Minor
          Found in src/oemof/solph/helpers.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_parent_block_sets has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def _add_parent_block_sets(self):
                  """Add all basic sets to the model, i.e. NODES, TIMESTEPS and FLOWS.
                  Also create sets PERIODS and TIMEINDEX used for multi-period models.
                  """
                  self.nodes = list(self.es.nodes)
          Severity: Minor
          Found in src/oemof/solph/_models.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 offset_converter_example has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def offset_converter_example():
              ##########################################################################
              # Initialize the energy system and calculate necessary parameters
              ##########################################################################
          
          

          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 equate_flows_by_keyword has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def equate_flows_by_keyword(
              model, keyword1, keyword2, factor1=1, name="equate_flows"
          ):
              r"""
              This wrapper for equate_flows allows to equate groups of flows by using a
          Severity: Minor
          Found in src/oemof/solph/constraints/equate_flows.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():
              # Read data file
              filename = os.path.join(os.getcwd(), "variable_chp.csv")
              try:
                  data = pd.read_csv(filename)
          Severity: Minor
          Found in examples/variable_chp/variable_chp.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 limit_active_flow_count has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def limit_active_flow_count(
              model, constraint_name, flows, lower_limit=0, upper_limit=None
          ):
              r"""
              Set limits (lower and/or upper) for the number of concurrently
          Severity: Minor
          Found in src/oemof/solph/constraints/flow_count_limit.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 run_add_constraints_example has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def run_add_constraints_example(solver="cbc", nologg=False):
              if not nologg:
                  logging.basicConfig(level=logging.INFO)
              # ##### creating an oemof solph optimization model, nothing special here ##
              # create an energy system object for the oemof solph nodes
          Severity: Minor
          Found in examples/flexible_modelling/add_constraints.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 _calculate_alphas has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def _calculate_alphas(self):
                  """
                  Calculate alpha coefficients.
          
                  A system of linear equations is created from passed capacities and
          Severity: Minor
          Found in src/oemof/solph/components/_generic_chp.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 create_time_index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def create_time_index(
              year: int = None,
              interval: float = 1,
              number: int = None,
              start: datetime.datetime or datetime.date = None,
          Severity: Minor
          Found in src/oemof/solph/_energy_system.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 check_oemof_installation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def check_oemof_installation(silent=False):
              logging.disable(logging.CRITICAL)
          
              date_time_index = pd.date_range("1/1/2012", periods=6, freq="H")
              energysystem = solph.EnergySystem(
          Severity: Minor
          Found in src/oemof/solph/_console_scripts.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 _extract_standard_model_result has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def _extract_standard_model_result(
              df_dict, result, result_index, remove_last_time_point
          ):
              """Extract and return the results of a standard model
          
          
          Severity: Minor
          Found in src/oemof/solph/processing.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 _create_variables has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def _create_variables(self):
                  r"""
                  :math:`Y_{status}` (binary) `om.NonConvexFlowBlock.status`:
                      Variable indicating if flow is >= 0
          
          
          Severity: Minor
          Found in src/oemof/solph/flows/_non_convex_flow_block.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self, energysystem, discount_rate=None, **kwargs):
                  if discount_rate is not None:
                      self.discount_rate = discount_rate
                  elif (
                      not isinstance(energysystem, list)
          Severity: Minor
          Found in src/oemof/solph/_models.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