Showing 4,753 of 10,532 total issues

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

            if meta_result['virtual_meters'] is not None and len(meta_result['virtual_meters']) > 0:
                for virtual_meter in meta_result['virtual_meters']:
                    cursor.execute(" SELECT name "
                                   " FROM tbl_virtual_meters "
                                   " WHERE id = %s ", (virtual_meter['id'],))
Severity: Major
Found in myems-api/core/combinedequipment.py and 11 other locations - About 1 day to fix
myems-api/core/combinedequipment.py on lines 2734..2757
myems-api/core/combinedequipment.py on lines 2758..2782
myems-api/core/combinedequipment.py on lines 2783..2807
myems-api/core/combinedequipment.py on lines 3301..3325
myems-api/core/combinedequipment.py on lines 3326..3350
myems-api/core/equipment.py on lines 2493..2516
myems-api/core/equipment.py on lines 2517..2540
myems-api/core/equipment.py on lines 2541..2564
myems-api/core/equipment.py on lines 2990..3013
myems-api/core/equipment.py on lines 3014..3038
myems-api/core/equipment.py on lines 3039..3063

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

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 new_values['meters'] is not None and len(new_values['meters']) > 0:
            for meter in new_values['meters']:
                cursor.execute(" SELECT name "
                               " FROM tbl_meters "
                               " WHERE id = %s ", (meter['id'],))
Severity: Major
Found in myems-api/core/combinedequipment.py and 11 other locations - About 1 day to fix
myems-api/core/combinedequipment.py on lines 2758..2782
myems-api/core/combinedequipment.py on lines 2783..2807
myems-api/core/combinedequipment.py on lines 3301..3325
myems-api/core/combinedequipment.py on lines 3326..3350
myems-api/core/combinedequipment.py on lines 3351..3375
myems-api/core/equipment.py on lines 2493..2516
myems-api/core/equipment.py on lines 2517..2540
myems-api/core/equipment.py on lines 2541..2564
myems-api/core/equipment.py on lines 2990..3013
myems-api/core/equipment.py on lines 3014..3038
myems-api/core/equipment.py on lines 3039..3063

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

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 meta_result['offline_meters'] is not None and len(meta_result['offline_meters']) > 0:
                for offline_meter in meta_result['offline_meters']:
                    cursor.execute(" SELECT name "
                                   " FROM tbl_offline_meters "
                                   " WHERE id = %s ", (offline_meter['id'],))
Severity: Major
Found in myems-api/core/equipment.py and 11 other locations - About 1 day to fix
myems-api/core/combinedequipment.py on lines 2734..2757
myems-api/core/combinedequipment.py on lines 2758..2782
myems-api/core/combinedequipment.py on lines 2783..2807
myems-api/core/combinedequipment.py on lines 3301..3325
myems-api/core/combinedequipment.py on lines 3326..3350
myems-api/core/combinedequipment.py on lines 3351..3375
myems-api/core/equipment.py on lines 2493..2516
myems-api/core/equipment.py on lines 2517..2540
myems-api/core/equipment.py on lines 2541..2564
myems-api/core/equipment.py on lines 2990..3013
myems-api/core/equipment.py on lines 3039..3063

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

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 meta_result['virtual_meters'] is not None and len(meta_result['virtual_meters']) > 0:
                for virtual_meter in meta_result['virtual_meters']:
                    cursor.execute(" SELECT name "
                                   " FROM tbl_virtual_meters "
                                   " WHERE id = %s ", (virtual_meter['id'],))
Severity: Major
Found in myems-api/core/equipment.py and 11 other locations - About 1 day to fix
myems-api/core/combinedequipment.py on lines 2734..2757
myems-api/core/combinedequipment.py on lines 2758..2782
myems-api/core/combinedequipment.py on lines 2783..2807
myems-api/core/combinedequipment.py on lines 3301..3325
myems-api/core/combinedequipment.py on lines 3326..3350
myems-api/core/combinedequipment.py on lines 3351..3375
myems-api/core/equipment.py on lines 2493..2516
myems-api/core/equipment.py on lines 2517..2540
myems-api/core/equipment.py on lines 2541..2564
myems-api/core/equipment.py on lines 2990..3013
myems-api/core/equipment.py on lines 3014..3038

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

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 new_values['virtual_meters'] is not None and len(new_values['virtual_meters']) > 0:
            for virtual_meter in new_values['virtual_meters']:
                cursor.execute(" SELECT name "
                               " FROM tbl_virtual_meters "
                               " WHERE id = %s ", (virtual_meter['id'],))
Severity: Major
Found in myems-api/core/combinedequipment.py and 11 other locations - About 1 day to fix
myems-api/core/combinedequipment.py on lines 2734..2757
myems-api/core/combinedequipment.py on lines 2758..2782
myems-api/core/combinedequipment.py on lines 3301..3325
myems-api/core/combinedequipment.py on lines 3326..3350
myems-api/core/combinedequipment.py on lines 3351..3375
myems-api/core/equipment.py on lines 2493..2516
myems-api/core/equipment.py on lines 2517..2540
myems-api/core/equipment.py on lines 2541..2564
myems-api/core/equipment.py on lines 2990..3013
myems-api/core/equipment.py on lines 3014..3038
myems-api/core/equipment.py on lines 3039..3063

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

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 new_values['offline_meters'] is not None and len(new_values['offline_meters']) > 0:
            for offline_meter in new_values['offline_meters']:
                cursor.execute(" SELECT name "
                               " FROM tbl_offline_meters "
                               " WHERE id = %s ", (offline_meter['id'],))
Severity: Major
Found in myems-api/core/combinedequipment.py and 11 other locations - About 1 day to fix
myems-api/core/combinedequipment.py on lines 2734..2757
myems-api/core/combinedequipment.py on lines 2783..2807
myems-api/core/combinedequipment.py on lines 3301..3325
myems-api/core/combinedequipment.py on lines 3326..3350
myems-api/core/combinedequipment.py on lines 3351..3375
myems-api/core/equipment.py on lines 2493..2516
myems-api/core/equipment.py on lines 2517..2540
myems-api/core/equipment.py on lines 2541..2564
myems-api/core/equipment.py on lines 2990..3013
myems-api/core/equipment.py on lines 3014..3038
myems-api/core/equipment.py on lines 3039..3063

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

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 new_values['offline_meters'] is not None and len(new_values['offline_meters']) > 0:
            for offline_meter in new_values['offline_meters']:
                cursor.execute(" SELECT name "
                               " FROM tbl_offline_meters "
                               " WHERE id = %s ", (offline_meter['id'],))
Severity: Major
Found in myems-api/core/equipment.py and 11 other locations - About 1 day to fix
myems-api/core/combinedequipment.py on lines 2734..2757
myems-api/core/combinedequipment.py on lines 2758..2782
myems-api/core/combinedequipment.py on lines 2783..2807
myems-api/core/combinedequipment.py on lines 3301..3325
myems-api/core/combinedequipment.py on lines 3326..3350
myems-api/core/combinedequipment.py on lines 3351..3375
myems-api/core/equipment.py on lines 2493..2516
myems-api/core/equipment.py on lines 2541..2564
myems-api/core/equipment.py on lines 2990..3013
myems-api/core/equipment.py on lines 3014..3038
myems-api/core/equipment.py on lines 3039..3063

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

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 meta_result['meters'] is not None and len(meta_result['meters']) > 0:
                for meter in meta_result['meters']:
                    cursor.execute(" SELECT name "
                                   " FROM tbl_meters "
                                   " WHERE id = %s ", (meter['id'],))
Severity: Major
Found in myems-api/core/combinedequipment.py and 11 other locations - About 1 day to fix
myems-api/core/combinedequipment.py on lines 2734..2757
myems-api/core/combinedequipment.py on lines 2758..2782
myems-api/core/combinedequipment.py on lines 2783..2807
myems-api/core/combinedequipment.py on lines 3326..3350
myems-api/core/combinedequipment.py on lines 3351..3375
myems-api/core/equipment.py on lines 2493..2516
myems-api/core/equipment.py on lines 2517..2540
myems-api/core/equipment.py on lines 2541..2564
myems-api/core/equipment.py on lines 2990..3013
myems-api/core/equipment.py on lines 3014..3038
myems-api/core/equipment.py on lines 3039..3063

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

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 new_values['meters'] is not None and len(new_values['meters']) > 0:
            for meter in new_values['meters']:
                cursor.execute(" SELECT name "
                               " FROM tbl_meters "
                               " WHERE id = %s ", (meter['id'],))
Severity: Major
Found in myems-api/core/equipment.py and 11 other locations - About 1 day to fix
myems-api/core/combinedequipment.py on lines 2734..2757
myems-api/core/combinedequipment.py on lines 2758..2782
myems-api/core/combinedequipment.py on lines 2783..2807
myems-api/core/combinedequipment.py on lines 3301..3325
myems-api/core/combinedequipment.py on lines 3326..3350
myems-api/core/combinedequipment.py on lines 3351..3375
myems-api/core/equipment.py on lines 2517..2540
myems-api/core/equipment.py on lines 2541..2564
myems-api/core/equipment.py on lines 2990..3013
myems-api/core/equipment.py on lines 3014..3038
myems-api/core/equipment.py on lines 3039..3063

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

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 new_values['virtual_meters'] is not None and len(new_values['virtual_meters']) > 0:
            for virtual_meter in new_values['virtual_meters']:
                cursor.execute(" SELECT name "
                               " FROM tbl_virtual_meters "
                               " WHERE id = %s ", (virtual_meter['id'],))
Severity: Major
Found in myems-api/core/equipment.py and 11 other locations - About 1 day to fix
myems-api/core/combinedequipment.py on lines 2734..2757
myems-api/core/combinedequipment.py on lines 2758..2782
myems-api/core/combinedequipment.py on lines 2783..2807
myems-api/core/combinedequipment.py on lines 3301..3325
myems-api/core/combinedequipment.py on lines 3326..3350
myems-api/core/combinedequipment.py on lines 3351..3375
myems-api/core/equipment.py on lines 2493..2516
myems-api/core/equipment.py on lines 2517..2540
myems-api/core/equipment.py on lines 2990..3013
myems-api/core/equipment.py on lines 3014..3038
myems-api/core/equipment.py on lines 3039..3063

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

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 meta_result['offline_meters'] is not None and len(meta_result['offline_meters']) > 0:
                for offline_meter in meta_result['offline_meters']:
                    cursor.execute(" SELECT name "
                                   " FROM tbl_offline_meters "
                                   " WHERE id = %s ", (offline_meter['id'],))
Severity: Major
Found in myems-api/core/combinedequipment.py and 11 other locations - About 1 day to fix
myems-api/core/combinedequipment.py on lines 2734..2757
myems-api/core/combinedequipment.py on lines 2758..2782
myems-api/core/combinedequipment.py on lines 2783..2807
myems-api/core/combinedequipment.py on lines 3301..3325
myems-api/core/combinedequipment.py on lines 3351..3375
myems-api/core/equipment.py on lines 2493..2516
myems-api/core/equipment.py on lines 2517..2540
myems-api/core/equipment.py on lines 2541..2564
myems-api/core/equipment.py on lines 2990..3013
myems-api/core/equipment.py on lines 3014..3038
myems-api/core/equipment.py on lines 3039..3063

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

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 (typeof this.props.distributionSystemID !== 'undefined') {
        fetch(APIBaseURL + '/reports/distributionsystem?distributionsystemid=' + this.props.distributionSystemID, {
          method: 'GET',
          headers: {
            'Content-type': 'application/json',
myems-web/src/components/MyEMS/AuxiliarySystem/RealtimeChart.js on lines 31..73

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

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 (this.props.distributionSystemID !== undefined) {
      fetch(APIBaseURL + '/reports/distributionsystem?distributionsystemid=' + this.props.distributionSystemID, {
        method: 'GET',
        headers: {
          'Content-type': 'application/json',
myems-web/src/components/MyEMS/AuxiliarySystem/RealtimeChart.js on lines 78..121

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

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

          modalInstance.result.then(function(modifiedMicrogridHeatpump) {
            modifiedMicrogridHeatpump.power_point_id = modifiedMicrogridHeatpump.power_point.id;
            modifiedMicrogridHeatpump.electricity_meter_id = modifiedMicrogridHeatpump.electricity_meter.id;
            modifiedMicrogridHeatpump.heat_meter_id = modifiedMicrogridHeatpump.heat_meter.id;
            modifiedMicrogridHeatpump.cooling_meter_id = modifiedMicrogridHeatpump.cooling_meter.id;
myems-admin/app/controllers/settings/microgrid/microgridheatpump.controller.js on lines 86..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 344.

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

          modalInstance.result.then(function(microgridheatpump) {
            microgridheatpump.power_point_id = microgridheatpump.power_point.id;
            microgridheatpump.electricity_meter_id = microgridheatpump.electricity_meter.id;
            microgridheatpump.heat_meter_id = microgridheatpump.heat_meter.id;
            microgridheatpump.cooling_meter_id = microgridheatpump.cooling_meter.id;
myems-admin/app/controllers/settings/microgrid/microgridheatpump.controller.js on lines 133..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 344.

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 energy_category_set is not None and len(energy_category_set) > 0:
            for energy_category_id in energy_category_set:
                associated_equipment_data[energy_category_id] = dict()
                associated_equipment_data[energy_category_id]['associated_equipment_names'] = list()
                associated_equipment_data[energy_category_id]['subtotals'] = list()
Severity: Major
Found in myems-api/reports/combinedequipmentcarbon.py and 11 other locations - About 1 day to fix
myems-api/reports/combinedequipmentcost.py on lines 520..542
myems-api/reports/combinedequipmentefficiency.py on lines 773..795
myems-api/reports/combinedequipmentenergyitem.py on lines 523..545
myems-api/reports/combinedequipmentincome.py on lines 500..522
myems-api/reports/combinedequipmentoutput.py on lines 500..523
myems-api/reports/combinedequipmentstatistics.py on lines 526..548
myems-api/reports/spacecarbon.py on lines 526..547
myems-api/reports/spacecost.py on lines 526..547
myems-api/reports/spaceenergyitem.py on lines 531..553
myems-api/reports/spaceincome.py on lines 507..528
myems-api/reports/spaceoutput.py on lines 507..528

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

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 energy_category_set is not None and len(energy_category_set) > 0:
            for energy_category_id in energy_category_set:
                child_space_data[energy_category_id] = dict()
                child_space_data[energy_category_id]['child_space_names'] = list()
                child_space_data[energy_category_id]['subtotals'] = list()
Severity: Major
Found in myems-api/reports/spaceoutput.py and 11 other locations - About 1 day to fix
myems-api/reports/combinedequipmentcarbon.py on lines 530..552
myems-api/reports/combinedequipmentcost.py on lines 520..542
myems-api/reports/combinedequipmentefficiency.py on lines 773..795
myems-api/reports/combinedequipmentenergyitem.py on lines 523..545
myems-api/reports/combinedequipmentincome.py on lines 500..522
myems-api/reports/combinedequipmentoutput.py on lines 500..523
myems-api/reports/combinedequipmentstatistics.py on lines 526..548
myems-api/reports/spacecarbon.py on lines 526..547
myems-api/reports/spacecost.py on lines 526..547
myems-api/reports/spaceenergyitem.py on lines 531..553
myems-api/reports/spaceincome.py on lines 507..528

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

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 energy_category_set is not None and len(energy_category_set) > 0:
            for energy_category_id in energy_category_set:
                child_space_data[energy_category_id] = dict()
                child_space_data[energy_category_id]['child_space_names'] = list()
                child_space_data[energy_category_id]['subtotals'] = list()
Severity: Major
Found in myems-api/reports/spacecarbon.py and 11 other locations - About 1 day to fix
myems-api/reports/combinedequipmentcarbon.py on lines 530..552
myems-api/reports/combinedequipmentcost.py on lines 520..542
myems-api/reports/combinedequipmentefficiency.py on lines 773..795
myems-api/reports/combinedequipmentenergyitem.py on lines 523..545
myems-api/reports/combinedequipmentincome.py on lines 500..522
myems-api/reports/combinedequipmentoutput.py on lines 500..523
myems-api/reports/combinedequipmentstatistics.py on lines 526..548
myems-api/reports/spacecost.py on lines 526..547
myems-api/reports/spaceenergyitem.py on lines 531..553
myems-api/reports/spaceincome.py on lines 507..528
myems-api/reports/spaceoutput.py on lines 507..528

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

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 energy_category_set is not None and len(energy_category_set) > 0:
            for energy_category_id in energy_category_set:
                child_space_data[energy_category_id] = dict()
                child_space_data[energy_category_id]['child_space_names'] = list()
                child_space_data[energy_category_id]['subtotals'] = list()
Severity: Major
Found in myems-api/reports/spaceincome.py and 11 other locations - About 1 day to fix
myems-api/reports/combinedequipmentcarbon.py on lines 530..552
myems-api/reports/combinedequipmentcost.py on lines 520..542
myems-api/reports/combinedequipmentefficiency.py on lines 773..795
myems-api/reports/combinedequipmentenergyitem.py on lines 523..545
myems-api/reports/combinedequipmentincome.py on lines 500..522
myems-api/reports/combinedequipmentoutput.py on lines 500..523
myems-api/reports/combinedequipmentstatistics.py on lines 526..548
myems-api/reports/spacecarbon.py on lines 526..547
myems-api/reports/spacecost.py on lines 526..547
myems-api/reports/spaceenergyitem.py on lines 531..553
myems-api/reports/spaceoutput.py on lines 507..528

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

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 energy_category_set is not None and len(energy_category_set) > 0:
            for energy_category_id in energy_category_set:
                associated_equipment_data[energy_category_id] = dict()
                associated_equipment_data[energy_category_id]['associated_equipment_names'] = list()
                associated_equipment_data[energy_category_id]['subtotals'] = list()
Severity: Major
Found in myems-api/reports/combinedequipmentcost.py and 11 other locations - About 1 day to fix
myems-api/reports/combinedequipmentcarbon.py on lines 530..552
myems-api/reports/combinedequipmentefficiency.py on lines 773..795
myems-api/reports/combinedequipmentenergyitem.py on lines 523..545
myems-api/reports/combinedequipmentincome.py on lines 500..522
myems-api/reports/combinedequipmentoutput.py on lines 500..523
myems-api/reports/combinedequipmentstatistics.py on lines 526..548
myems-api/reports/spacecarbon.py on lines 526..547
myems-api/reports/spacecost.py on lines 526..547
myems-api/reports/spaceenergyitem.py on lines 531..553
myems-api/reports/spaceincome.py on lines 507..528
myems-api/reports/spaceoutput.py on lines 507..528

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

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