oemof/oemof-solph

View on GitHub

Showing 139 of 424 total issues

Function _startup_costs has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def _startup_costs(self):
        r"""
        .. math::
            \sum_{i, o \in STARTUPFLOWS} \sum_t  Y_{startup}(t) \
            \cdot c_{startup}
Severity: Minor
Found in src/oemof/solph/flows/_non_convex_flow_block.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 _shutdown_costs has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def _shutdown_costs(self):
        r"""
        .. math::
            \sum_{SHUTDOWNFLOWS} \sum_t Y_{shutdown}(t) \
            \cdot c_{shutdown}
Severity: Minor
Found in src/oemof/solph/flows/_non_convex_flow_block.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 _inactivity_costs has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def _inactivity_costs(self):
        r"""
        .. math::
            \sum_{INACTIVITYCOSTFLOWS} \sum_t (1 - Y_{status}(t)) \
            \cdot c_{inactivity}
Severity: Minor
Found in src/oemof/solph/flows/_non_convex_flow_block.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 meta_results has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def meta_results(om, undefined=False):
    """
    Fetch some metadata from the Solver. Feel free to add more keys.

    Valid keys of the resulting dictionary are: 'objective', 'problem',
Severity: Minor
Found in src/oemof/solph/processing.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

NonConvexFlowBlock has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class NonConvexFlowBlock(ScalarBlock):
    r"""
    .. automethod:: _create_constraints
    .. automethod:: _create_variables
    .. automethod:: _create_sets
Severity: Minor
Found in src/oemof/solph/flows/_non_convex_flow_block.py - About 2 hrs to fix

    File _invest_non_convex_flow_block.py has 262 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    
    """Creating sets, variables, constraints and parts of the objective function
    for Flow objects with both Nonconvex and Investment options.
    
    
    Severity: Minor
    Found in src/oemof/solph/flows/_invest_non_convex_flow_block.py - About 2 hrs to fix

      Function _create has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def _create(self, group=None):
              """Creates the relation for the class:`Link`.
      
              Parameters
              ----------
      Severity: Minor
      Found in src/oemof/solph/components/_link.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 _old_dsm_capacity_rule_end has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

                  def _old_dsm_capacity_rule_end(block):
                      """Rule definition for determining old endogenously installed
                      capacity to be decommissioned due to reaching its lifetime.
                      Investment and decommissioning periods are linked within
                      the constraint. The respective decommissioning period is
      Severity: Minor
      Found in src/oemof/solph/components/experimental/_sink_dsm.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 results has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def results(model, remove_last_time_point=False):
          """Create a nested result dictionary from the result DataFrame
      
          The already rearranged results from Pyomo from the result DataFrame are
          transferred into a nested dictionary of pandas objects.
      Severity: Minor
      Found in src/oemof/solph/processing.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__ has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, energysystem, **kwargs):
              """Initialize a BaseModel, using its energysystem as well as
              optional kwargs for specifying the timeincrement, objective_weighting
              and constraint_groups."""
              super().__init__()
      Severity: Minor
      Found in src/oemof/solph/_models.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

      File _flow.py has 253 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      
      """
      solph version of oemof.network.Edge
      
      
      Severity: Minor
      Found in src/oemof/solph/flows/_flow.py - About 2 hrs to fix

        File _energy_system.py has 251 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        
        """
        solph version of oemof.network.energy_system
        
        
        Severity: Minor
        Found in src/oemof/solph/_energy_system.py - About 2 hrs to fix

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

              def __init__(
                  self,
                  demand,
                  capacity_up,
                  capacity_down,
          Severity: Minor
          Found in src/oemof/solph/components/experimental/_sink_dsm.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 has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def _create(self, group=None):
                  """Creates the linear constraint for the class:`ElectricalLine`
                  block.
          
                  Parameters
          Severity: Minor
          Found in src/oemof/solph/flows/experimental/_electrical_line.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 main has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def main(dump_and_restore=False):
              # For models that need a long time to optimise, saving and loading the
              # EnergySystem might be advised. By default, we do not do this here. Feel
              # free to experiment with this once you understood the rest of the code.
              dump_results = restore_results = dump_and_restore
          Severity: Minor
          Found in examples/basic_example/basic_example.py - About 1 hr to fix

            Function storage_level_constraint has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            def storage_level_constraint(
                model,
                name,
                storage_component,
                multiplexer_bus,
            Severity: Minor
            Found in src/oemof/solph/constraints/storage_level.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 main has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def main():
                data = [0, 15, 30, 35, 20, 25, 27, 10, 5, 2, 15, 40, 20, 0, 0]
            
                # create an energy system
                idx = solph.create_time_index(2017, number=len(data))
            Severity: Minor
            Found in examples/investment_with_minimal_invest/minimal_invest.py - About 1 hr to fix

              Function main has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def main():
                  # Read data file
                  filename = os.path.join(os.getcwd(), "tuple_as_label.csv")
                  try:
                      data = pd.read_csv(filename)
              Severity: Minor
              Found in examples/tuple_as_labels/tuple_as_label.py - About 1 hr to fix

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

                    def __init__(
                Severity: Major
                Found in src/oemof/solph/_options.py - About 1 hr to fix

                  Function _objective_expression has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _objective_expression(self):
                          r"""
                          Objective expression for storages with no investment.
                  
                          Note
                  Severity: Minor
                  Found in src/oemof/solph/components/_generic_storage.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

                  Severity
                  Category
                  Status
                  Source
                  Language