oemof/oemof-solph

View on GitHub

Showing 139 of 397 total issues

Function saturating_storage_example has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def saturating_storage_example():
    # create an energy system
    idx = pd.date_range("1/1/2023", periods=100, freq="h")
    es = solph.EnergySystem(timeindex=idx, infer_last_interval=False)

Severity: Minor
Found in examples/flexible_modelling/saturating_storage.py - About 1 hr to fix

    Function optimise_scenario has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def optimise_scenario():
        logger.define_logging()
        datetime_index = pd.date_range(
            "2016-01-01 00:00:00", "2016-01-01 23:00:00", freq="60min"
        )
    Severity: Minor
    Found in examples/excel_reader/dispatch.py - About 1 hr to fix

      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 plot_partload has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def plot_partload(self, bus, tstep):
                """Create a matplotlib figure of the flow to nonconvex flow relation.
        
                Parameters
                ----------
        Severity: Minor
        Found in src/oemof/solph/components/_offset_converter.py - About 1 hr to fix

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

              def __init__(

            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 __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

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

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

                    def __init__(self, energysystem, discount_rate=None, **kwargs):
                        super().__init__()
                
                        # Check root logger. Due to a problem with pyomo the building of the
                        # model will take up to a 100 times longer if the root logger is set
                Severity: Minor
                Found in src/oemof/solph/_models.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 normed_offset_and_conversion_factors_from_coefficients has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def normed_offset_and_conversion_factors_from_coefficients(
                        self, coefficients
                    ):
                        """
                        Calculate slope and offset for new API from the old API coefficients.
                Severity: Minor
                Found in src/oemof/solph/components/_offset_converter.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 _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 create_dataframe has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                def create_dataframe(om):
                    """Create a result DataFrame with all optimization data
                
                    Results from Pyomo are written into one common pandas.DataFrame where
                    separate columns are created for the variable index e.g. for tuples
                Severity: Minor
                Found in src/oemof/solph/processing.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 create_time_index has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                def create_time_index(
                    year: int = None,
                    interval: float = 1,
                    number: int = None,
                    start: datetime.date = None,
                Severity: Minor
                Found in src/oemof/solph/_helpers.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 exec_in_env has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                def exec_in_env():
                    env_path = join(base_path, ".tox", "bootstrap")
                    if sys.platform == "win32":
                        bin_path = join(env_path, "Scripts")
                    else:
                Severity: Minor
                Found in ci/bootstrap.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 _evaluate_remaining_value_difference has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _evaluate_remaining_value_difference(
                        self,
                        m,
                        p,
                        i,
                Severity: Minor
                Found in src/oemof/solph/flows/_investment_flow_block.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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(
                Severity: Major
                Found in src/oemof/solph/components/experimental/_generic_caes.py - About 50 mins to fix

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

                      def __init__(
                  Severity: Major
                  Found in src/oemof/solph/components/_offset_converter.py - About 50 mins to fix

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

                        def _evaluate_remaining_value_difference(
                    Severity: Major
                    Found in src/oemof/solph/components/experimental/_sink_dsm.py - About 50 mins to fix

                      Function shared_limit has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def shared_limit(
                      Severity: Major
                      Found in src/oemof/solph/constraints/shared_limit.py - About 50 mins to fix

                        Function generic_integral_limit has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def generic_integral_limit(
                        Severity: Major
                        Found in src/oemof/solph/constraints/integral_limit.py - About 50 mins to fix

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

                              def _evaluate_remaining_value_difference(
                          Severity: Major
                          Found in src/oemof/solph/components/experimental/_sink_dsm.py - About 50 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language