Showing 4,754 of 10,533 total issues

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

        for energy_storage_power_station in energy_storage_power_station_list:
            energy_storage_power_station['subtotal_charge_billing'] = Decimal(0.0)
            for row in rows_energy_storage_power_stations_subtotal_charge_billing:
                if row[0] == energy_storage_power_station['id']:
                    energy_storage_power_station['subtotal_charge_billing'] = row[1]
Severity: Major
Found in myems-api/reports/energystoragepowerstationdashboard.py and 11 other locations - About 5 hrs to fix
myems-api/reports/energystoragepowerstationdashboard.py on lines 162..169
myems-api/reports/energystoragepowerstationdashboard.py on lines 182..189
myems-api/reports/energystoragepowerstationdashboard.py on lines 222..229
myems-api/reports/energystoragepowerstationdashboard.py on lines 241..248
myems-api/reports/energystoragepowerstationdashboard.py on lines 260..267
myems-api/reports/microgriddashboard.py on lines 221..228
myems-api/reports/microgriddashboard.py on lines 241..248
myems-api/reports/microgriddashboard.py on lines 261..268
myems-api/reports/microgriddashboard.py on lines 281..288
myems-api/reports/microgriddashboard.py on lines 300..307
myems-api/reports/microgriddashboard.py on lines 319..326

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

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

        for microgrid in microgrid_list:
            microgrid['subtotal_charge_energy'] = Decimal(0.0)
            for row in rows_microgrids_subtotal_charge_energy:
                if row[0] == microgrid['id']:
                    microgrid['subtotal_charge_energy'] = row[1]
Severity: Major
Found in myems-api/reports/microgriddashboard.py and 11 other locations - About 5 hrs to fix
myems-api/reports/energystoragepowerstationdashboard.py on lines 162..169
myems-api/reports/energystoragepowerstationdashboard.py on lines 182..189
myems-api/reports/energystoragepowerstationdashboard.py on lines 202..209
myems-api/reports/energystoragepowerstationdashboard.py on lines 222..229
myems-api/reports/energystoragepowerstationdashboard.py on lines 241..248
myems-api/reports/energystoragepowerstationdashboard.py on lines 260..267
myems-api/reports/microgriddashboard.py on lines 241..248
myems-api/reports/microgriddashboard.py on lines 261..268
myems-api/reports/microgriddashboard.py on lines 281..288
myems-api/reports/microgriddashboard.py on lines 300..307
myems-api/reports/microgriddashboard.py on lines 319..326

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

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

        for energy_storage_power_station in energy_storage_power_station_list:
            energy_storage_power_station['subtotal_charge_energy'] = Decimal(0.0)
            for row in rows_energy_storage_power_stations_subtotal_charge_energy:
                if row[0] == energy_storage_power_station['id']:
                    energy_storage_power_station['subtotal_charge_energy'] = row[1]
Severity: Major
Found in myems-api/reports/energystoragepowerstationdashboard.py and 11 other locations - About 5 hrs to fix
myems-api/reports/energystoragepowerstationdashboard.py on lines 182..189
myems-api/reports/energystoragepowerstationdashboard.py on lines 202..209
myems-api/reports/energystoragepowerstationdashboard.py on lines 222..229
myems-api/reports/energystoragepowerstationdashboard.py on lines 241..248
myems-api/reports/energystoragepowerstationdashboard.py on lines 260..267
myems-api/reports/microgriddashboard.py on lines 221..228
myems-api/reports/microgriddashboard.py on lines 241..248
myems-api/reports/microgriddashboard.py on lines 261..268
myems-api/reports/microgriddashboard.py on lines 281..288
myems-api/reports/microgriddashboard.py on lines 300..307
myems-api/reports/microgriddashboard.py on lines 319..326

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

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

        for microgrid in microgrid_list:
            microgrid['subtotal_discharge_billing'] = Decimal(0.0)
            for row in rows_microgrids_subtotal_discharge_billing:
                if row[0] == microgrid['id']:
                    microgrid['subtotal_discharge_billing'] = row[1]
Severity: Major
Found in myems-api/reports/microgriddashboard.py and 11 other locations - About 5 hrs to fix
myems-api/reports/energystoragepowerstationdashboard.py on lines 162..169
myems-api/reports/energystoragepowerstationdashboard.py on lines 182..189
myems-api/reports/energystoragepowerstationdashboard.py on lines 202..209
myems-api/reports/energystoragepowerstationdashboard.py on lines 222..229
myems-api/reports/energystoragepowerstationdashboard.py on lines 241..248
myems-api/reports/energystoragepowerstationdashboard.py on lines 260..267
myems-api/reports/microgriddashboard.py on lines 221..228
myems-api/reports/microgriddashboard.py on lines 241..248
myems-api/reports/microgriddashboard.py on lines 261..268
myems-api/reports/microgriddashboard.py on lines 300..307
myems-api/reports/microgriddashboard.py on lines 319..326

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

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

        for microgrid in microgrid_list:
            microgrid['subtotal_discharge_energy'] = Decimal(0.0)
            for row in rows_microgrids_subtotal_discharge_energy:
                if row[0] == microgrid['id']:
                    microgrid['subtotal_discharge_energy'] = row[1]
Severity: Major
Found in myems-api/reports/microgriddashboard.py and 11 other locations - About 5 hrs to fix
myems-api/reports/energystoragepowerstationdashboard.py on lines 162..169
myems-api/reports/energystoragepowerstationdashboard.py on lines 182..189
myems-api/reports/energystoragepowerstationdashboard.py on lines 202..209
myems-api/reports/energystoragepowerstationdashboard.py on lines 222..229
myems-api/reports/energystoragepowerstationdashboard.py on lines 241..248
myems-api/reports/energystoragepowerstationdashboard.py on lines 260..267
myems-api/reports/microgriddashboard.py on lines 221..228
myems-api/reports/microgriddashboard.py on lines 261..268
myems-api/reports/microgriddashboard.py on lines 281..288
myems-api/reports/microgriddashboard.py on lines 300..307
myems-api/reports/microgriddashboard.py on lines 319..326

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

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

                line.title = _('Reporting Period Cumulative Efficiency') + ' - ' + \
                    reporting_period_data['names'][i] + "-" + \
                    reporting_period_data['numerator_names'][i] \
                    + " (" + reporting_period_data['numerator_units'][i] + ")"
Severity: Major
Found in myems-api/excelexporters/combinedequipmentefficiency.py and 1 other location - About 5 hrs to fix
myems-api/excelexporters/combinedequipmentefficiency.py on lines 540..543

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

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

                line.title = _('Reporting Period Cumulative Efficiency') + ' - ' + \
                    reporting_period_data['names'][i] + "-" + \
                    reporting_period_data['denominator_names'][i] \
                    + " (" + reporting_period_data['denominator_units'][i] + ")"
Severity: Major
Found in myems-api/excelexporters/combinedequipmentefficiency.py and 1 other location - About 5 hrs to fix
myems-api/excelexporters/combinedequipmentefficiency.py on lines 515..518

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

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

    const mousemove = () => {
      let user_name = getCookieValue('user_name');
      let user_display_name = getCookieValue('user_display_name');
      let user_uuid = getCookieValue('user_uuid');
      let token = getCookieValue('token');
Severity: Major
Found in myems-web/src/Main.js and 1 other location - About 5 hrs to fix
myems-web/src/Main.js on lines 130..141

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

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

    const mousedown = () => {
      let user_name = getCookieValue('user_name');
      let user_display_name = getCookieValue('user_display_name');
      let user_uuid = getCookieValue('user_uuid');
      let token = getCookieValue('token');
Severity: Major
Found in myems-web/src/Main.js and 1 other location - About 5 hrs to fix
myems-web/src/Main.js on lines 118..129

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

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

            <NavItem>
              <NavLink
                className={classNames('font-weight-semi-bold', {
                  'done cursor-pointer': step > 1,
                  active: step === 1
Severity: Major
Found in myems-web/src/components/auth/wizard/UserForm.js and 2 other locations - About 5 hrs to fix
myems-web/src/components/auth/wizard/UserForm.js on lines 61..76
myems-web/src/components/auth/wizard/UserForm.js on lines 77..92

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

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

            <NavItem>
              <NavLink
                className={classNames('font-weight-semi-bold', {
                  'done  cursor-pointer': step > 2,
                  active: step === 2
Severity: Major
Found in myems-web/src/components/auth/wizard/UserForm.js and 2 other locations - About 5 hrs to fix
myems-web/src/components/auth/wizard/UserForm.js on lines 45..60
myems-web/src/components/auth/wizard/UserForm.js on lines 77..92

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

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

            <NavItem>
              <NavLink
                className={classNames('font-weight-semi-bold', {
                  'done  cursor-pointer': step > 3,
                  active: step === 3
Severity: Major
Found in myems-web/src/components/auth/wizard/UserForm.js and 2 other locations - About 5 hrs to fix
myems-web/src/components/auth/wizard/UserForm.js on lines 45..60
myems-web/src/components/auth/wizard/UserForm.js on lines 61..76

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

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

  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.popover')
      var options = typeof option == 'object' && option
Severity: Major
Found in myems-admin/js/bootstrap/bootstrap.js and 1 other location - About 5 hrs to fix
myems-admin/js/bootstrap/bootstrap.js on lines 1936..1946

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

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

  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.tooltip')
      var options = typeof option == 'object' && option
Severity: Major
Found in myems-admin/js/bootstrap/bootstrap.js and 1 other location - About 5 hrs to fix
myems-admin/js/bootstrap/bootstrap.js on lines 2060..2070

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

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

        if offline_meter_id is None:
            raise falcon.HTTPError(status=falcon.HTTP_400,
                                   title='API.BAD_REQUEST',
                                   description='API.INVALID_OFFLINE_METER_ID')
        else:
Severity: Major
Found in myems-api/reports/offlinemeterenergy.py and 6 other locations - About 5 hrs to fix
myems-api/reports/distributionsystem.py on lines 41..47
myems-api/reports/energyflowdiagram.py on lines 48..55
myems-api/reports/offlinemetercarbon.py on lines 53..60
myems-api/reports/offlinemetercost.py on lines 53..60
myems-api/reports/virtualmetercarbon.py on lines 53..60
myems-api/reports/virtualmetercost.py on lines 53..60

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

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

        if virtual_meter_id is None:
            raise falcon.HTTPError(status=falcon.HTTP_400,
                                   title='API.BAD_REQUEST',
                                   description='API.INVALID_VIRTUAL_METER_ID')
        else:
Severity: Major
Found in myems-api/reports/virtualmetercarbon.py and 6 other locations - About 5 hrs to fix
myems-api/reports/distributionsystem.py on lines 41..47
myems-api/reports/energyflowdiagram.py on lines 48..55
myems-api/reports/offlinemetercarbon.py on lines 53..60
myems-api/reports/offlinemetercost.py on lines 53..60
myems-api/reports/offlinemeterenergy.py on lines 51..58
myems-api/reports/virtualmetercost.py on lines 53..60

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

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

        if virtual_meter_id is None:
            raise falcon.HTTPError(status=falcon.HTTP_400,
                                   title='API.BAD_REQUEST',
                                   description='API.INVALID_VIRTUAL_METER_ID')
        else:
Severity: Major
Found in myems-api/reports/virtualmetercost.py and 6 other locations - About 5 hrs to fix
myems-api/reports/distributionsystem.py on lines 41..47
myems-api/reports/energyflowdiagram.py on lines 48..55
myems-api/reports/offlinemetercarbon.py on lines 53..60
myems-api/reports/offlinemetercost.py on lines 53..60
myems-api/reports/offlinemeterenergy.py on lines 51..58
myems-api/reports/virtualmetercarbon.py on lines 53..60

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

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

        if offline_meter_id is None:
            raise falcon.HTTPError(status=falcon.HTTP_400,
                                   title='API.BAD_REQUEST',
                                   description='API.INVALID_OFFLINE_METER_ID')
        else:
Severity: Major
Found in myems-api/reports/offlinemetercarbon.py and 6 other locations - About 5 hrs to fix
myems-api/reports/distributionsystem.py on lines 41..47
myems-api/reports/energyflowdiagram.py on lines 48..55
myems-api/reports/offlinemetercost.py on lines 53..60
myems-api/reports/offlinemeterenergy.py on lines 51..58
myems-api/reports/virtualmetercarbon.py on lines 53..60
myems-api/reports/virtualmetercost.py on lines 53..60

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

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

        if offline_meter_id is None:
            raise falcon.HTTPError(status=falcon.HTTP_400,
                                   title='API.BAD_REQUEST',
                                   description='API.INVALID_OFFLINE_METER_ID')
        else:
Severity: Major
Found in myems-api/reports/offlinemetercost.py and 6 other locations - About 5 hrs to fix
myems-api/reports/distributionsystem.py on lines 41..47
myems-api/reports/energyflowdiagram.py on lines 48..55
myems-api/reports/offlinemetercarbon.py on lines 53..60
myems-api/reports/offlinemeterenergy.py on lines 51..58
myems-api/reports/virtualmetercarbon.py on lines 53..60
myems-api/reports/virtualmetercost.py on lines 53..60

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

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

        meta_result = {"id": row[0],
                       "created_datetime":
                           (row[1] +
                            timedelta(hours=int(config.utc_offset[1:3]))).strftime('%Y-%m-%dT%H:%M:%S'),
                       "status": row[2],
Severity: Major
Found in myems-api/core/notification.py and 1 other location - About 5 hrs to fix
myems-api/core/notification.py on lines 143..150

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

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