Showing 4,754 of 10,533 total issues

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

            if rows is not None and len(rows) > 0:
                for row in rows:
                    result = {"id": row[0], "name": row[1], "uuid": row[2],
                              "energy_category": energy_category_dict.get(row[3], None)}
                    virtualmeter_result.append(result)
Severity: Major
Found in myems-api/core/shopfloor.py and 14 other locations - About 5 hrs to fix
myems-api/core/shopfloor.py on lines 2036..2041
myems-api/core/shopfloor.py on lines 2071..2076
myems-api/core/shopfloor.py on lines 2597..2602
myems-api/core/shopfloor.py on lines 2632..2637
myems-api/core/shopfloor.py on lines 2658..2663
myems-api/core/space.py on lines 3762..3767
myems-api/core/space.py on lines 3788..3793
myems-api/core/space.py on lines 3814..3819
myems-api/core/space.py on lines 4674..4679
myems-api/core/space.py on lines 4700..4705
myems-api/core/space.py on lines 4726..4731
myems-api/core/store.py on lines 1984..1989
myems-api/core/store.py on lines 2010..2015
myems-api/core/store.py on lines 2035..2040

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 97.

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 15 locations. Consider refactoring.
Open

            if rows is not None and len(rows) > 0:
                for row in rows:
                    result = {"id": row[0], "name": row[1], "uuid": row[2],
                              "energy_category": energy_category_dict.get(row[3], None)}
                    meter_result.append(result)
Severity: Major
Found in myems-api/core/space.py and 14 other locations - About 5 hrs to fix
myems-api/core/shopfloor.py on lines 2036..2041
myems-api/core/shopfloor.py on lines 2071..2076
myems-api/core/shopfloor.py on lines 2097..2102
myems-api/core/shopfloor.py on lines 2597..2602
myems-api/core/shopfloor.py on lines 2632..2637
myems-api/core/shopfloor.py on lines 2658..2663
myems-api/core/space.py on lines 3762..3767
myems-api/core/space.py on lines 3788..3793
myems-api/core/space.py on lines 3814..3819
myems-api/core/space.py on lines 4700..4705
myems-api/core/space.py on lines 4726..4731
myems-api/core/store.py on lines 1984..1989
myems-api/core/store.py on lines 2010..2015
myems-api/core/store.py on lines 2035..2040

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 97.

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 15 locations. Consider refactoring.
Open

            if rows is not None and len(rows) > 0:
                for row in rows:
                    result = {"id": row[0], "name": row[1], "uuid": row[2],
                              "energy_category": energy_category_dict.get(row[3], None)}
                    meter_result.append(result)
Severity: Major
Found in myems-api/core/space.py and 14 other locations - About 5 hrs to fix
myems-api/core/shopfloor.py on lines 2036..2041
myems-api/core/shopfloor.py on lines 2071..2076
myems-api/core/shopfloor.py on lines 2097..2102
myems-api/core/shopfloor.py on lines 2597..2602
myems-api/core/shopfloor.py on lines 2632..2637
myems-api/core/shopfloor.py on lines 2658..2663
myems-api/core/space.py on lines 3788..3793
myems-api/core/space.py on lines 3814..3819
myems-api/core/space.py on lines 4674..4679
myems-api/core/space.py on lines 4700..4705
myems-api/core/space.py on lines 4726..4731
myems-api/core/store.py on lines 1984..1989
myems-api/core/store.py on lines 2010..2015
myems-api/core/store.py on lines 2035..2040

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 97.

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 3 locations. Consider refactoring.
Open

                elif circuit_list[x]['points'][y]['object_type'] == 'DIGITAL_VALUE':
                    query = (" SELECT actual_value "
                             " FROM tbl_digital_value_latest "
                             " WHERE point_id = %s "
                             "       AND utc_date_time > %s ")
Severity: Major
Found in myems-api/reports/distributionsystem.py and 2 other locations - About 5 hrs to fix
myems-api/reports/distributionsystem.py on lines 121..132
myems-api/reports/distributionsystem.py on lines 134..144

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 97.

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 3 locations. Consider refactoring.
Open

                result['reporting_period']['increment_rates'].append(
                    (reporting[energy_item_id]['subtotal'] - base[energy_item_id]['subtotal']) /
                    base[energy_item_id]['subtotal']
                    if base[energy_item_id]['subtotal'] > Decimal(0.0) else None)
Severity: Major
Found in myems-api/reports/combinedequipmentenergyitem.py and 2 other locations - About 5 hrs to fix
myems-api/reports/combinedequipmentenergycategory.py on lines 734..737
myems-api/reports/spaceefficiency.py on lines 716..720

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 97.

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 15 locations. Consider refactoring.
Open

            if rows is not None and len(rows) > 0:
                for row in rows:
                    result = {"id": row[0], "name": row[1], "uuid": row[2],
                              "energy_category": energy_category_dict.get(row[3], None)}
                    meter_result.append(result)
Severity: Major
Found in myems-api/core/shopfloor.py and 14 other locations - About 5 hrs to fix
myems-api/core/shopfloor.py on lines 2036..2041
myems-api/core/shopfloor.py on lines 2071..2076
myems-api/core/shopfloor.py on lines 2097..2102
myems-api/core/shopfloor.py on lines 2632..2637
myems-api/core/shopfloor.py on lines 2658..2663
myems-api/core/space.py on lines 3762..3767
myems-api/core/space.py on lines 3788..3793
myems-api/core/space.py on lines 3814..3819
myems-api/core/space.py on lines 4674..4679
myems-api/core/space.py on lines 4700..4705
myems-api/core/space.py on lines 4726..4731
myems-api/core/store.py on lines 1984..1989
myems-api/core/store.py on lines 2010..2015
myems-api/core/store.py on lines 2035..2040

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 97.

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 15 locations. Consider refactoring.
Open

            if rows is not None and len(rows) > 0:
                for row in rows:
                    result = {"id": row[0], "name": row[1], "uuid": row[2],
                              "energy_category": energy_category_dict.get(row[3], None)}
                    offlinemeter_result.append(result)
Severity: Major
Found in myems-api/core/space.py and 14 other locations - About 5 hrs to fix
myems-api/core/shopfloor.py on lines 2036..2041
myems-api/core/shopfloor.py on lines 2071..2076
myems-api/core/shopfloor.py on lines 2097..2102
myems-api/core/shopfloor.py on lines 2597..2602
myems-api/core/shopfloor.py on lines 2632..2637
myems-api/core/shopfloor.py on lines 2658..2663
myems-api/core/space.py on lines 3762..3767
myems-api/core/space.py on lines 3814..3819
myems-api/core/space.py on lines 4674..4679
myems-api/core/space.py on lines 4700..4705
myems-api/core/space.py on lines 4726..4731
myems-api/core/store.py on lines 1984..1989
myems-api/core/store.py on lines 2010..2015
myems-api/core/store.py on lines 2035..2040

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 97.

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 15 locations. Consider refactoring.
Open

            if rows is not None and len(rows) > 0:
                for row in rows:
                    result = {"id": row[0], "name": row[1], "uuid": row[2],
                              "energy_category": energy_category_dict.get(row[3], None)}
                    offlinemeter_result.append(result)
Severity: Major
Found in myems-api/core/space.py and 14 other locations - About 5 hrs to fix
myems-api/core/shopfloor.py on lines 2036..2041
myems-api/core/shopfloor.py on lines 2071..2076
myems-api/core/shopfloor.py on lines 2097..2102
myems-api/core/shopfloor.py on lines 2597..2602
myems-api/core/shopfloor.py on lines 2632..2637
myems-api/core/shopfloor.py on lines 2658..2663
myems-api/core/space.py on lines 3762..3767
myems-api/core/space.py on lines 3788..3793
myems-api/core/space.py on lines 3814..3819
myems-api/core/space.py on lines 4674..4679
myems-api/core/space.py on lines 4726..4731
myems-api/core/store.py on lines 1984..1989
myems-api/core/store.py on lines 2010..2015
myems-api/core/store.py on lines 2035..2040

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 97.

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 15 locations. Consider refactoring.
Open

            if rows is not None and len(rows) > 0:
                for row in rows:
                    result = {"id": row[0], "name": row[1], "uuid": row[2],
                              "energy_category": energy_category_dict.get(row[3], None)}
                    virtualmeter_result.append(result)
Severity: Major
Found in myems-api/core/space.py and 14 other locations - About 5 hrs to fix
myems-api/core/shopfloor.py on lines 2036..2041
myems-api/core/shopfloor.py on lines 2071..2076
myems-api/core/shopfloor.py on lines 2097..2102
myems-api/core/shopfloor.py on lines 2597..2602
myems-api/core/shopfloor.py on lines 2632..2637
myems-api/core/shopfloor.py on lines 2658..2663
myems-api/core/space.py on lines 3762..3767
myems-api/core/space.py on lines 3788..3793
myems-api/core/space.py on lines 4674..4679
myems-api/core/space.py on lines 4700..4705
myems-api/core/space.py on lines 4726..4731
myems-api/core/store.py on lines 1984..1989
myems-api/core/store.py on lines 2010..2015
myems-api/core/store.py on lines 2035..2040

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 97.

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 15 locations. Consider refactoring.
Open

            if rows is not None and len(rows) > 0:
                for row in rows:
                    result = {"id": row[0], "name": row[1], "uuid": row[2],
                              "energy_category": energy_category_dict.get(row[3], None)}
                    meter_result.append(result)
Severity: Major
Found in myems-api/core/store.py and 14 other locations - About 5 hrs to fix
myems-api/core/shopfloor.py on lines 2036..2041
myems-api/core/shopfloor.py on lines 2071..2076
myems-api/core/shopfloor.py on lines 2097..2102
myems-api/core/shopfloor.py on lines 2597..2602
myems-api/core/shopfloor.py on lines 2632..2637
myems-api/core/shopfloor.py on lines 2658..2663
myems-api/core/space.py on lines 3762..3767
myems-api/core/space.py on lines 3788..3793
myems-api/core/space.py on lines 3814..3819
myems-api/core/space.py on lines 4674..4679
myems-api/core/space.py on lines 4700..4705
myems-api/core/space.py on lines 4726..4731
myems-api/core/store.py on lines 2010..2015
myems-api/core/store.py on lines 2035..2040

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 97.

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 15 locations. Consider refactoring.
Open

            if rows is not None and len(rows) > 0:
                for row in rows:
                    result = {"id": row[0], "name": row[1], "uuid": row[2],
                              "energy_category": energy_category_dict.get(row[3], None)}
                    virtualmeter_result.append(result)
Severity: Major
Found in myems-api/core/store.py and 14 other locations - About 5 hrs to fix
myems-api/core/shopfloor.py on lines 2036..2041
myems-api/core/shopfloor.py on lines 2071..2076
myems-api/core/shopfloor.py on lines 2097..2102
myems-api/core/shopfloor.py on lines 2597..2602
myems-api/core/shopfloor.py on lines 2632..2637
myems-api/core/shopfloor.py on lines 2658..2663
myems-api/core/space.py on lines 3762..3767
myems-api/core/space.py on lines 3788..3793
myems-api/core/space.py on lines 3814..3819
myems-api/core/space.py on lines 4674..4679
myems-api/core/space.py on lines 4700..4705
myems-api/core/space.py on lines 4726..4731
myems-api/core/store.py on lines 1984..1989
myems-api/core/store.py on lines 2010..2015

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 97.

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 3 locations. Consider refactoring.
Open

                result['reporting_period_input']['increment_rates'].append(
                    (reporting_input[energy_category_id]['subtotal'] -
                     base_input[energy_category_id]['subtotal']) /
                    base_input[energy_category_id]['subtotal']
                    if base_input[energy_category_id]['subtotal'] > Decimal(0.0) else None)
Severity: Major
Found in myems-api/reports/spaceefficiency.py and 2 other locations - About 5 hrs to fix
myems-api/reports/combinedequipmentenergycategory.py on lines 734..737
myems-api/reports/combinedequipmentenergyitem.py on lines 616..619

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 97.

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 3 locations. Consider refactoring.
Open

                if circuit_list[x]['points'][y]['object_type'] == 'ANALOG_VALUE':

                    query = (" SELECT actual_value "
                             " FROM tbl_analog_value_latest "
                             " WHERE point_id = %s "
Severity: Major
Found in myems-api/reports/distributionsystem.py and 2 other locations - About 5 hrs to fix
myems-api/reports/distributionsystem.py on lines 134..144
myems-api/reports/distributionsystem.py on lines 146..156

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 97.

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 3 locations. Consider refactoring.
Open

                result['reporting_period']['increment_rates'].append(
                    (reporting[energy_category_id]['subtotal'] - base[energy_category_id]['subtotal']) /
                    base[energy_category_id]['subtotal']
                    if base[energy_category_id]['subtotal'] > Decimal(0.0) else None)
Severity: Major
Found in myems-api/reports/combinedequipmentenergycategory.py and 2 other locations - About 5 hrs to fix
myems-api/reports/combinedequipmentenergyitem.py on lines 616..619
myems-api/reports/spaceefficiency.py on lines 716..720

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 97.

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 3 locations. Consider refactoring.
Open

                elif circuit_list[x]['points'][y]['object_type'] == 'ENERGY_VALUE':
                    query = (" SELECT actual_value "
                             " FROM tbl_energy_value_latest "
                             " WHERE point_id = %s "
                             "       AND utc_date_time > %s ")
Severity: Major
Found in myems-api/reports/distributionsystem.py and 2 other locations - About 5 hrs to fix
myems-api/reports/distributionsystem.py on lines 121..132
myems-api/reports/distributionsystem.py on lines 146..156

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 97.

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

    await fetch(
      APIBaseURL +
      '/reports/offlinemeterdaily?' +
      'offlinemeterid=' +
      Offlinemeter +
Severity: Major
Found in myems-web/src/components/MyEMS/Meter/OfflineMeterInput.js and 1 other location - About 5 hrs to fix
myems-web/src/components/MyEMS/AuxiliarySystem/EnergyFlowDiagram.js on lines 278..319

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 153.

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

      this.callGotFocus = function(a, b, e, f) {
        angular.isDefined(c.events) && c.events.gotFocus
          ? c.events.gotFocus({
              event: a,
              item: b,
Severity: Major
Found in myems-admin/js/jcui/angular.integralui.treeview.min.js and 1 other location - About 5 hrs to fix
myems-admin/js/jcui/angular.integralui.treeview.min.js on lines 1813..1829

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 153.

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

ProductList.propTypes = {
  title: PropTypes.string.isRequired,
  category: PropTypes.string.isRequired,
  rating: PropTypes.number.isRequired,
  review: PropTypes.number.isRequired,
Severity: Major
Found in myems-web/src/components/e-commerce/product/ProductList.js and 1 other location - About 5 hrs to fix
myems-web/src/components/e-commerce/product/ProductGrid.js on lines 144..158

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 153.

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

    fetch(
      APIBaseURL +
        '/reports/energyflowdiagram?' +
        'energyflowdiagramid=' +
        selectedEnergyFlowDiagram +
myems-web/src/components/MyEMS/Meter/OfflineMeterInput.js on lines 123..168

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 153.

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

      this.callLostFocus = function(a, b, e, f) {
        angular.isDefined(c.events) && c.events.lostFocus
          ? c.events.lostFocus({
              event: a,
              item: b,
Severity: Major
Found in myems-admin/js/jcui/angular.integralui.treeview.min.js and 1 other location - About 5 hrs to fix
myems-admin/js/jcui/angular.integralui.treeview.min.js on lines 1796..1812

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 153.

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

Severity
Category
Status
Source
Language