oemof/oemof-solph

View on GitHub
examples/simple_dispatch/simple_dispatch.py

Summary

Maintainability
D
2 days
Test Coverage

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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        if tick_distance > 0:
            ax.set_xticklabels(
                [
                    item.strftime("%d-%m-%Y")
                    for item in dates.tolist()[0::tick_distance]
    Severity: Major
    Found in examples/simple_dispatch/simple_dispatch.py and 1 other location - About 2 hrs to fix
    examples/simple_dispatch/simple_dispatch.py on lines 246..250

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 52.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        if tick_distance > 0:
            ax.set_xticklabels(
                [
                    item.strftime("%d-%m-%Y")
                    for item in dates.tolist()[0::tick_distance]
    Severity: Major
    Found in examples/simple_dispatch/simple_dispatch.py and 1 other location - About 2 hrs to fix
    examples/simple_dispatch/simple_dispatch.py on lines 275..279

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 52.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        energysystem.add(
            Converter(
                label="pp_coal",
                inputs={bcoal: Flow()},
                outputs={bel: Flow(nominal_value=20.2, variable_costs=25)},
    Severity: Major
    Found in examples/simple_dispatch/simple_dispatch.py and 3 other locations - About 1 hr to fix
    examples/simple_dispatch/simple_dispatch.py on lines 146..151
    examples/simple_dispatch/simple_dispatch.py on lines 155..160
    examples/simple_dispatch/simple_dispatch.py on lines 164..169

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 47.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        energysystem.add(
            Converter(
                label="pp_lig",
                inputs={blig: Flow()},
                outputs={bel: Flow(nominal_value=11.8, variable_costs=19)},
    Severity: Major
    Found in examples/simple_dispatch/simple_dispatch.py and 3 other locations - About 1 hr to fix
    examples/simple_dispatch/simple_dispatch.py on lines 137..142
    examples/simple_dispatch/simple_dispatch.py on lines 155..160
    examples/simple_dispatch/simple_dispatch.py on lines 164..169

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 47.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        energysystem.add(
            Converter(
                label="pp_oil",
                inputs={boil: Flow()},
                outputs={bel: Flow(nominal_value=5, variable_costs=50)},
    Severity: Major
    Found in examples/simple_dispatch/simple_dispatch.py and 3 other locations - About 1 hr to fix
    examples/simple_dispatch/simple_dispatch.py on lines 137..142
    examples/simple_dispatch/simple_dispatch.py on lines 146..151
    examples/simple_dispatch/simple_dispatch.py on lines 155..160

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 47.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        energysystem.add(
            Converter(
                label="pp_gas",
                inputs={bgas: Flow()},
                outputs={bel: Flow(nominal_value=41, variable_costs=40)},
    Severity: Major
    Found in examples/simple_dispatch/simple_dispatch.py and 3 other locations - About 1 hr to fix
    examples/simple_dispatch/simple_dispatch.py on lines 137..142
    examples/simple_dispatch/simple_dispatch.py on lines 146..151
    examples/simple_dispatch/simple_dispatch.py on lines 164..169

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 47.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        energysystem.add(
            Source(
                label="wind",
                outputs={bel: Flow(fix=data["wind"], nominal_value=66.3)},
    Severity: Minor
    Found in examples/simple_dispatch/simple_dispatch.py and 1 other location - About 55 mins to fix
    examples/simple_dispatch/simple_dispatch.py on lines 115..117

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 37.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        energysystem.add(
            Sink(
                label="demand_th",
                inputs={bth: Flow(nominal_value=40, fix=data["demand_th"])},
    Severity: Minor
    Found in examples/simple_dispatch/simple_dispatch.py and 1 other location - About 55 mins to fix
    examples/simple_dispatch/simple_dispatch.py on lines 122..125

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 37.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        energysystem.add(
            Sink(
                label="demand_el",
                inputs={bel: Flow(nominal_value=85, fix=data["demand_el"])},
    Severity: Minor
    Found in examples/simple_dispatch/simple_dispatch.py and 1 other location - About 55 mins to fix
    examples/simple_dispatch/simple_dispatch.py on lines 129..132

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 37.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        energysystem.add(
            Source(
                label="pv", outputs={bel: Flow(fix=data["pv"], nominal_value=65.3)}
    Severity: Minor
    Found in examples/simple_dispatch/simple_dispatch.py and 1 other location - About 55 mins to fix
    examples/simple_dispatch/simple_dispatch.py on lines 108..111

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 37.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status