oemof/oemof-solph

View on GitHub

Showing 139 of 397 total issues

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

    File diesel_genset_nonconvex_investment.py has 369 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      File _models.py has 363 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 4 hrs to fix

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

            def __init__(
        Severity: Major
        Found in src/oemof/solph/components/experimental/_sink_dsm.py - About 3 hrs to fix

          File dispatch.py has 324 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          
          """
          General description
          -------------------
          Severity: Minor
          Found in examples/excel_reader/dispatch.py - About 3 hrs to fix

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

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

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

                  def _create(self, group=None):
                      """Creates the relation for the class:`OffsetConverter`.
              
                      Parameters
                      ----------
              Severity: Minor
              Found in src/oemof/solph/components/_offset_converter.py - About 3 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 offset_converter_example has 87 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Function net_storage_flow has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                def net_storage_flow(results, node_type):
                    """Calculates the net storage flow for storage models that have one
                    input edge and one output edge both with flows within the domain of
                    non-negative reals.
                
                
                Severity: Minor
                Found in src/oemof/solph/views.py - About 3 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 has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

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

                    def _create(self, group=None):
                        """
                        Create constraints for GenericCAESBlock.
                
                        Parameters
                Severity: Major
                Found in src/oemof/solph/components/experimental/_generic_caes.py - About 2 hrs to fix

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

                      def __init__(
                  Severity: Major
                  Found in src/oemof/solph/components/_generic_storage.py - About 2 hrs to fix

                    Function node has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def node(results, node, multiindex=False, keep_none_type=False):
                        """
                        Obtain results for a single node e.g. a Bus or Component.
                    
                        Either a node or its label string can be passed.
                    Severity: Minor
                    Found in src/oemof/solph/views.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 _shared_constraints_for_non_convex_flows has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _shared_constraints_for_non_convex_flows(self):
                            r"""
                    
                            .. automethod:: _startup_constraint
                            .. automethod:: _max_startup_constraint
                    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 __init__ has 21 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def __init__(
                    Severity: Major
                    Found in src/oemof/solph/flows/_flow.py - About 2 hrs to fix

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

                          def __init__(
                              self,
                              inputs,
                              outputs,
                              label=None,
                      Severity: Minor
                      Found in src/oemof/solph/components/_offset_converter.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 main has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      def main():
                          # Read data file
                          filename = os.path.join(os.getcwd(), "input_data.csv")
                          try:
                              data = pd.read_csv(filename)
                      Severity: Major
                      Found in examples/simple_dispatch/simple_dispatch.py - About 2 hrs to fix

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

                            def __init__(
                                self,
                                timeindex=None,
                                timeincrement=None,
                                infer_last_interval=None,
                        Severity: Minor
                        Found in src/oemof/solph/_energy_system.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
                          Severity
                          Category
                          Status
                          Source
                          Language