oemof/oemof-solph

View on GitHub
src/oemof/solph/components/_generic_storage.py

Summary

Maintainability
F
1 wk
Test Coverage

File _generic_storage.py has 1611 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

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

            def __init__(
                self,
                label=None,
                inputs=None,
                outputs=None,
        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 __init__ has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def __init__(
                self,
                label=None,
                inputs=None,
                outputs=None,
        Severity: Minor
        Found in src/oemof/solph/components/_generic_storage.py - About 1 hr to fix

          Function _evaluate_remaining_value_difference has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def _evaluate_remaining_value_difference(
          Severity: Major
          Found in src/oemof/solph/components/_generic_storage.py - About 1 hr to fix

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

                def _create(self, group=None):
                    """
                    Parameters
                    ----------
                    group : list
            Severity: Minor
            Found in src/oemof/solph/components/_generic_storage.py - About 55 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 8 (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 45 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

            There are no issues that match your filters.

            Category
            Status