oemof/oemof-solph

View on GitHub

Showing 139 of 424 total issues

File _sink_dsm.py has 4619 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-

"""
Implementation of demand-side management (demand response) which allows for

Severity: Major
Found in src/oemof/solph/components/experimental/_sink_dsm.py - About 1 wk to fix

    File _generic_storage.py has 1618 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -
    
    """
    GenericStorage and associated individual constraints (blocks) and groupings.
    
    
    Severity: Major
    Found in src/oemof/solph/components/_generic_storage.py - About 4 days to fix

      File _investment_flow_block.py has 957 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 investment but without nonconvex option.
      
      
      Severity: Major
      Found in src/oemof/solph/flows/_investment_flow_block.py - About 2 days to fix

        File _non_convex_flow_block.py has 730 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 nonconvex but without investment options.
        
        
        Severity: Major
        Found in src/oemof/solph/flows/_non_convex_flow_block.py - About 1 day to fix

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

              def _create(self, group=None):
                  """Create a storage block for investment modeling"""
                  m = self.parent_block()
                  if group is None:
                      return None
          Severity: Minor
          Found in src/oemof/solph/components/_generic_storage.py - About 1 day 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_constraints has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
          Open

              def _create_constraints(self):
                  r"""Creates all constraints for standard flows.
          
                  Depending on the attributes of the *InvestmentFlowBlock*
                  and *SimpleFlowBlock*, different constraints are created.
          Severity: Minor
          Found in src/oemof/solph/flows/_investment_flow_block.py - About 1 day 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 _generic_caes.py has 574 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          
          """
          In-development generic compressed air energy storage.
          
          
          Severity: Major
          Found in src/oemof/solph/components/experimental/_generic_caes.py - About 1 day to fix

            File processing.py has 526 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            
            """Modules for providing a convenient data structure for solph results.
            
            Information about the possible usage is provided within the examples.
            Severity: Major
            Found in src/oemof/solph/processing.py - About 1 day to fix

              Function __separate_attrs has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
              Open

              def __separate_attrs(
                  system, exclude_attrs, get_flows=False, exclude_none=True
              ):
                  """
                  Create a dictionary with flow scalars and series.
              Severity: Minor
              Found in src/oemof/solph/processing.py - About 1 day 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_constraints has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _create_constraints(self):
                      r"""Creates all constraints for standard flows.
              
                      The following constraints are created, if the appropriate attribute of
                      the *Flow* (see :class:`~oemof.solph.flows._flow.Flow`) object is set:
              Severity: Minor
              Found in src/oemof/solph/flows/_simple_flow_block.py - About 7 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 create_nodes has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
              Open

              def create_nodes(nd=None):
                  """Create nodes (oemof objects) from node dict
              
                  Parameters
                  ----------
              Severity: Minor
              Found in examples/excel_reader/dispatch.py - About 7 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 45 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __init__(
                      self,
                      nominal_value=None,
                      variable_costs=0,
                      min=None,
              Severity: Minor
              Found in src/oemof/solph/flows/_flow.py - About 6 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 _simple_flow_block.py has 450 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 neither nonconvex nor investment options.
              
              
              Severity: Minor
              Found in src/oemof/solph/flows/_simple_flow_block.py - About 6 hrs to fix

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

                    def _objective_expression(self):
                        r"""Objective expression for flows with investment attribute of type
                        class:`.Investment`. The returned costs are fixed and
                        investment costs. Variable costs are added from the standard flow
                        objective expression.
                Severity: Minor
                Found in src/oemof/solph/flows/_investment_flow_block.py - About 6 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 offset_diesel_genset_nonconvex_investment.py has 439 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # -*- coding: utf-8 -*-
                
                """
                General description
                -------------------

                  File _models.py has 427 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # -*- coding: utf-8 -*-
                  
                  """Solph Optimization Models.
                  
                  SPDX-FileCopyrightText: Uwe Krien <krien@uni-bremen.de>
                  Severity: Minor
                  Found in src/oemof/solph/_models.py - About 6 hrs to fix

                    File _generic_chp.py has 421 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # -*- coding: utf-8 -
                    
                    """
                    GenericCHP and associated individual constraints (blocks) and groupings.
                    
                    
                    Severity: Minor
                    Found in src/oemof/solph/components/_generic_chp.py - About 6 hrs to fix

                      Function _add_parent_block_variables has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _add_parent_block_variables(self):
                              """Add the parent block variables, which is the `flow` variable,
                              indexed by FLOWS and TIMEINDEX."""
                              self.flow = po.Var(self.FLOWS, self.TIMEINDEX, within=po.Reals)
                      
                      
                      Severity: Minor
                      Found in src/oemof/solph/_models.py - About 5 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 _objective_expression has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _objective_expression(self):
                              r"""Objective expression for all standard flows with fixed costs
                              and variable costs.
                      
                              Depending on the attributes of the `Flow` object the following parts of
                      Severity: Minor
                      Found in src/oemof/solph/flows/_simple_flow_block.py - About 5 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 variable_chp.py has 371 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      # -*- coding: utf-8 -*-
                      
                      """
                      General description
                      -------------------
                      Severity: Minor
                      Found in examples/variable_chp/variable_chp.py - About 4 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language