oemof/oemof-solph

View on GitHub

Showing 140 of 425 total issues

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

    def _create(self, group=None):
        """
        Create constraints for GenericCAESBlock.

        Parameters
Severity: Minor
Found in src/oemof/solph/components/experimental/_generic_caes.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 investment_limit_per_period has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def investment_limit_per_period(model, limit=None):
    r"""Set an absolute limit for the total investment costs of a
    investment optimization problem for each period
    of the multi-period problem.

Severity: Minor
Found in src/oemof/solph/constraints/investment_limit.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 _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

Function storage_level_constraint_example has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def storage_level_constraint_example():
    es = EnergySystem(
        timeindex=pd.date_range("2022-01-01", freq="1H", periods=24),
        infer_last_interval=True,
    )
Severity: Minor
Found in examples/storage_level_constraint/storage_level_constraint.py - About 1 hr to fix

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

    def main():
        # Read data file
        filename = os.path.join(os.getcwd(), "storage_investment.csv")
        try:
            data = pd.read_csv(filename)

      Function main has 38 lines of code (exceeds 25 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 1 hr to fix

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

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

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

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

            Function _create has 36 lines of code (exceeds 25 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 hr to fix

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

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

              def _check_and_set_flows(om, flows, keyword):
                  """Checks and sets flows if needed
              
                  Parameters
                  ----------
              Severity: Minor
              Found in src/oemof/solph/constraints/integral_limit.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 convert_keys_to_strings has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              def convert_keys_to_strings(result, keep_none_type=False):
                  """
                  Convert the dictionary keys to strings.
              
                  All (tuple) keys of the result object e.g. results[(pp1, bus1)] are
              Severity: Minor
              Found in src/oemof/solph/processing.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 __init__ has 35 lines of code (exceeds 25 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

                Function main has 34 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(2020, number=len(data))
                Severity: Minor
                Found in examples/generic_invest_limit/example_generic_invest.py - About 1 hr to fix

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

                  def main():
                      # Read data file
                      filename = os.path.join(os.getcwd(), "storage_investment.csv")
                      try:
                          data = pd.read_csv(filename)

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

                    def main():
                        # Read data file
                        filename = os.path.join(os.getcwd(), "storage_investment.csv")
                        try:
                            data = pd.read_csv(filename)

                      Function _create_variables has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _create_variables(self, group):
                              r"""Creates all variables for standard flows.
                      
                              All *Flow* objects are indexed by a starting and ending node
                              :math:`(i, o)`, which is omitted in the following for the sake of
                      Severity: Minor
                      Found in src/oemof/solph/flows/_simple_flow_block.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 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _create(self, group=None):
                              """Creates the balance constraints for the class:`BusBlock` block.
                      
                              Parameters
                              ----------
                      Severity: Minor
                      Found in src/oemof/solph/buses/_bus.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 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def _create(self, group=None):
                              """
                              Create constraints for GenericCHPBlock.
                      
                              Parameters
                      Severity: Minor
                      Found in src/oemof/solph/components/_generic_chp.py - About 1 hr to fix

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

                        def main():
                            # *************************************************************************
                            # ********** PART 1 - Define and optimise the energy system ***************
                            # *************************************************************************
                        
                        
                        Severity: Minor
                        Found in examples/dual_variable_example/dual_variable_example.py - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language