Showing 4,754 of 10,533 total issues

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

                    for i in range(len(base_output[energy_category_id_output]['timestamps'])):
                        efficiency_values.append((base_output[energy_category_id_output]['values'][i] /
                                                  base_input[energy_category_id_input]['values'][i])
                                                 if base_input[energy_category_id_input]['values'][i] > Decimal(0.0)
Severity: Major
Found in myems-api/reports/spaceefficiency.py and 1 other location - About 7 hrs to fix
myems-api/reports/spaceefficiency.py on lines 769..773

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

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

        if 'privilege_id' in new_values['data'].keys():
            if not isinstance(new_values['data']['privilege_id'], int) or \
                    new_values['data']['privilege_id'] <= 0:
                raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                       description='API.INVALID_PRIVILEGE_ID')
Severity: Major
Found in myems-api/core/user.py and 3 other locations - About 7 hrs to fix
myems-api/core/meter.py on lines 172..179
myems-api/core/user.py on lines 383..390
myems-api/core/user.py on lines 1948..1955

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

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

        if 'privilege_id' in new_values['data'].keys():
            if not isinstance(new_values['data']['privilege_id'], int) or \
                    new_values['data']['privilege_id'] <= 0:
                raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                       description='API.INVALID_PRIVILEGE_ID')
Severity: Major
Found in myems-api/core/user.py and 3 other locations - About 7 hrs to fix
myems-api/core/meter.py on lines 172..179
myems-api/core/user.py on lines 131..138
myems-api/core/user.py on lines 383..390

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

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

        if 'privilege_id' in new_values['data'].keys():
            if not isinstance(new_values['data']['privilege_id'], int) or \
                    new_values['data']['privilege_id'] <= 0:
                raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                       description='API.INVALID_PRIVILEGE_ID')
Severity: Major
Found in myems-api/core/user.py and 3 other locations - About 7 hrs to fix
myems-api/core/meter.py on lines 172..179
myems-api/core/user.py on lines 131..138
myems-api/core/user.py on lines 1948..1955

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

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

        if 'master_meter_id' in new_values['data'].keys():
            if not isinstance(new_values['data']['master_meter_id'], int) or \
                    new_values['data']['master_meter_id'] <= 0:
                raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                       description='API.INVALID_MASTER_METER_ID')
Severity: Major
Found in myems-api/core/meter.py and 3 other locations - About 7 hrs to fix
myems-api/core/user.py on lines 131..138
myems-api/core/user.py on lines 383..390
myems-api/core/user.py on lines 1948..1955

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

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 'set_value' not in new_values['data'].keys():
            set_value = None
        elif isinstance(new_values['data']['set_value'], float) or \
                isinstance(new_values['data']['set_value'], int):
            set_value = float(new_values['data']['set_value'])
Severity: Major
Found in myems-api/core/command.py and 1 other location - About 7 hrs to fix
myems-api/core/command.py on lines 343..349

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

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 'set_value' not in new_values['data'].keys():
            set_value = None
        elif isinstance(new_values['data']['set_value'], float) or \
                isinstance(new_values['data']['set_value'], int):
            set_value = float(new_values['data']['set_value'])
Severity: Major
Found in myems-api/core/command.py and 1 other location - About 7 hrs to fix
myems-api/core/command.py on lines 91..97

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

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 12 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),
                              "is_output": bool(row[4])}
Severity: Major
Found in myems-api/core/combinedequipment.py and 11 other locations - About 6 hrs to fix
myems-api/core/combinedequipment.py on lines 2397..2403
myems-api/core/combinedequipment.py on lines 2453..2459
myems-api/core/combinedequipment.py on lines 3070..3076
myems-api/core/combinedequipment.py on lines 3098..3104
myems-api/core/combinedequipment.py on lines 3126..3132
myems-api/core/equipment.py on lines 2202..2210
myems-api/core/equipment.py on lines 2219..2227
myems-api/core/equipment.py on lines 2236..2244
myems-api/core/equipment.py on lines 2804..2812
myems-api/core/equipment.py on lines 2821..2829
myems-api/core/equipment.py on lines 2838..2846

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

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 12 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),
                              "is_output": bool(row[4])}
Severity: Major
Found in myems-api/core/combinedequipment.py and 11 other locations - About 6 hrs to fix
myems-api/core/combinedequipment.py on lines 2397..2403
myems-api/core/combinedequipment.py on lines 2425..2431
myems-api/core/combinedequipment.py on lines 2453..2459
myems-api/core/combinedequipment.py on lines 3070..3076
myems-api/core/combinedequipment.py on lines 3098..3104
myems-api/core/equipment.py on lines 2202..2210
myems-api/core/equipment.py on lines 2219..2227
myems-api/core/equipment.py on lines 2236..2244
myems-api/core/equipment.py on lines 2804..2812
myems-api/core/equipment.py on lines 2821..2829
myems-api/core/equipment.py on lines 2838..2846

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

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 12 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],
Severity: Major
Found in myems-api/core/equipment.py and 11 other locations - About 6 hrs to fix
myems-api/core/combinedequipment.py on lines 2397..2403
myems-api/core/combinedequipment.py on lines 2425..2431
myems-api/core/combinedequipment.py on lines 2453..2459
myems-api/core/combinedequipment.py on lines 3070..3076
myems-api/core/combinedequipment.py on lines 3098..3104
myems-api/core/combinedequipment.py on lines 3126..3132
myems-api/core/equipment.py on lines 2202..2210
myems-api/core/equipment.py on lines 2219..2227
myems-api/core/equipment.py on lines 2236..2244
myems-api/core/equipment.py on lines 2821..2829
myems-api/core/equipment.py on lines 2838..2846

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

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 12 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),
                              "is_output": bool(row[4])}
Severity: Major
Found in myems-api/core/combinedequipment.py and 11 other locations - About 6 hrs to fix
myems-api/core/combinedequipment.py on lines 2397..2403
myems-api/core/combinedequipment.py on lines 2425..2431
myems-api/core/combinedequipment.py on lines 3070..3076
myems-api/core/combinedequipment.py on lines 3098..3104
myems-api/core/combinedequipment.py on lines 3126..3132
myems-api/core/equipment.py on lines 2202..2210
myems-api/core/equipment.py on lines 2219..2227
myems-api/core/equipment.py on lines 2236..2244
myems-api/core/equipment.py on lines 2804..2812
myems-api/core/equipment.py on lines 2821..2829
myems-api/core/equipment.py on lines 2838..2846

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

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 12 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],
Severity: Major
Found in myems-api/core/equipment.py and 11 other locations - About 6 hrs to fix
myems-api/core/combinedequipment.py on lines 2397..2403
myems-api/core/combinedequipment.py on lines 2425..2431
myems-api/core/combinedequipment.py on lines 2453..2459
myems-api/core/combinedequipment.py on lines 3070..3076
myems-api/core/combinedequipment.py on lines 3098..3104
myems-api/core/combinedequipment.py on lines 3126..3132
myems-api/core/equipment.py on lines 2202..2210
myems-api/core/equipment.py on lines 2219..2227
myems-api/core/equipment.py on lines 2804..2812
myems-api/core/equipment.py on lines 2821..2829
myems-api/core/equipment.py on lines 2838..2846

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

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 12 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),
                              "is_output": bool(row[4])}
Severity: Major
Found in myems-api/core/combinedequipment.py and 11 other locations - About 6 hrs to fix
myems-api/core/combinedequipment.py on lines 2397..2403
myems-api/core/combinedequipment.py on lines 2425..2431
myems-api/core/combinedequipment.py on lines 2453..2459
myems-api/core/combinedequipment.py on lines 3098..3104
myems-api/core/combinedequipment.py on lines 3126..3132
myems-api/core/equipment.py on lines 2202..2210
myems-api/core/equipment.py on lines 2219..2227
myems-api/core/equipment.py on lines 2236..2244
myems-api/core/equipment.py on lines 2804..2812
myems-api/core/equipment.py on lines 2821..2829
myems-api/core/equipment.py on lines 2838..2846

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

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 12 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],
Severity: Major
Found in myems-api/core/equipment.py and 11 other locations - About 6 hrs to fix
myems-api/core/combinedequipment.py on lines 2397..2403
myems-api/core/combinedequipment.py on lines 2425..2431
myems-api/core/combinedequipment.py on lines 2453..2459
myems-api/core/combinedequipment.py on lines 3070..3076
myems-api/core/combinedequipment.py on lines 3098..3104
myems-api/core/combinedequipment.py on lines 3126..3132
myems-api/core/equipment.py on lines 2202..2210
myems-api/core/equipment.py on lines 2236..2244
myems-api/core/equipment.py on lines 2804..2812
myems-api/core/equipment.py on lines 2821..2829
myems-api/core/equipment.py on lines 2838..2846

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

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 12 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),
                              "is_output": bool(row[4])}
Severity: Major
Found in myems-api/core/combinedequipment.py and 11 other locations - About 6 hrs to fix
myems-api/core/combinedequipment.py on lines 2425..2431
myems-api/core/combinedequipment.py on lines 2453..2459
myems-api/core/combinedequipment.py on lines 3070..3076
myems-api/core/combinedequipment.py on lines 3098..3104
myems-api/core/combinedequipment.py on lines 3126..3132
myems-api/core/equipment.py on lines 2202..2210
myems-api/core/equipment.py on lines 2219..2227
myems-api/core/equipment.py on lines 2236..2244
myems-api/core/equipment.py on lines 2804..2812
myems-api/core/equipment.py on lines 2821..2829
myems-api/core/equipment.py on lines 2838..2846

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

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 12 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),
                              "is_output": bool(row[4])}
Severity: Major
Found in myems-api/core/combinedequipment.py and 11 other locations - About 6 hrs to fix
myems-api/core/combinedequipment.py on lines 2397..2403
myems-api/core/combinedequipment.py on lines 2425..2431
myems-api/core/combinedequipment.py on lines 2453..2459
myems-api/core/combinedequipment.py on lines 3070..3076
myems-api/core/combinedequipment.py on lines 3126..3132
myems-api/core/equipment.py on lines 2202..2210
myems-api/core/equipment.py on lines 2219..2227
myems-api/core/equipment.py on lines 2236..2244
myems-api/core/equipment.py on lines 2804..2812
myems-api/core/equipment.py on lines 2821..2829
myems-api/core/equipment.py on lines 2838..2846

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

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 12 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],
Severity: Major
Found in myems-api/core/equipment.py and 11 other locations - About 6 hrs to fix
myems-api/core/combinedequipment.py on lines 2397..2403
myems-api/core/combinedequipment.py on lines 2425..2431
myems-api/core/combinedequipment.py on lines 2453..2459
myems-api/core/combinedequipment.py on lines 3070..3076
myems-api/core/combinedequipment.py on lines 3098..3104
myems-api/core/combinedequipment.py on lines 3126..3132
myems-api/core/equipment.py on lines 2202..2210
myems-api/core/equipment.py on lines 2219..2227
myems-api/core/equipment.py on lines 2236..2244
myems-api/core/equipment.py on lines 2804..2812
myems-api/core/equipment.py on lines 2838..2846

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

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 12 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],
Severity: Major
Found in myems-api/core/equipment.py and 11 other locations - About 6 hrs to fix
myems-api/core/combinedequipment.py on lines 2397..2403
myems-api/core/combinedequipment.py on lines 2425..2431
myems-api/core/combinedequipment.py on lines 2453..2459
myems-api/core/combinedequipment.py on lines 3070..3076
myems-api/core/combinedequipment.py on lines 3098..3104
myems-api/core/combinedequipment.py on lines 3126..3132
myems-api/core/equipment.py on lines 2219..2227
myems-api/core/equipment.py on lines 2236..2244
myems-api/core/equipment.py on lines 2804..2812
myems-api/core/equipment.py on lines 2821..2829
myems-api/core/equipment.py on lines 2838..2846

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

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 12 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],
Severity: Major
Found in myems-api/core/equipment.py and 11 other locations - About 6 hrs to fix
myems-api/core/combinedequipment.py on lines 2397..2403
myems-api/core/combinedequipment.py on lines 2425..2431
myems-api/core/combinedequipment.py on lines 2453..2459
myems-api/core/combinedequipment.py on lines 3070..3076
myems-api/core/combinedequipment.py on lines 3098..3104
myems-api/core/combinedequipment.py on lines 3126..3132
myems-api/core/equipment.py on lines 2202..2210
myems-api/core/equipment.py on lines 2219..2227
myems-api/core/equipment.py on lines 2236..2244
myems-api/core/equipment.py on lines 2804..2812
myems-api/core/equipment.py on lines 2821..2829

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

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

  function getCursor(location) {
    switch (location) {
      default:
      case 1:
        return cursor > maxCursor - 3 && maxCursor - 3 >= 0 ? maxCursor - 3 : cursor;
myems-web/src/components/MyEMS/Meter/MeterRealtime.js on lines 212..224

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

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