oemof/oemof-solph

View on GitHub

Showing 139 of 397 total issues

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

        def _set_flows(self):
            """Define inflow / outflow as investment flows when they are
            coupled with storage capacity via invest relations
            """
            for flow in self.inputs.values():
    Severity: Minor
    Found in src/oemof/solph/components/_generic_storage.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

    Avoid too many return statements within this function.
    Open

                return True
    Severity: Major
    Found in src/oemof/solph/_plumbing.py - About 30 mins to fix

      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 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 _inactivity_costs has a Cognitive Complexity of 6 (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 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

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

      def generic_integral_limit(
          om,
          keyword,
          flows=None,
          upper_limit=None,
      Severity: Minor
      Found in src/oemof/solph/constraints/integral_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 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 _activity_costs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _activity_costs(self):
              r"""
              .. math::
                  \sum_{ACTIVITYCOSTFLOWS} \sum_t Y_{status}(t) \
                  \cdot c_{activity}
      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 _startup_costs has a Cognitive Complexity of 6 (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 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 _shutdown_costs has a Cognitive Complexity of 6 (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 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 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 _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 _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

      Severity
      Category
      Status
      Source
      Language