Showing 10,536 of 10,536 total issues

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

app.controller('TenantSensorController', function (
    $scope,
    $window,
    $translate,
    TenantService,
myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstationcontainer.controller.js on lines 3..110
myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstationuser.controller.js on lines 3..110
myems-admin/app/controllers/settings/microgrid/microgridsensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/microgrid/microgriduser.controller.js on lines 3..110
myems-admin/app/controllers/settings/shopfloor/shopfloorequipment.controller.js on lines 3..110
myems-admin/app/controllers/settings/shopfloor/shopfloorsensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/store/storesensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/virtualpowerplant/virtualpowerplantmicrogrid.controller.js on lines 3..110

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

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

app.controller('EnergyStoragePowerStationContainerController', function (
    $scope,
    $window,
    $translate,
    EnergyStoragePowerStationService,
myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstationuser.controller.js on lines 3..110
myems-admin/app/controllers/settings/microgrid/microgridsensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/microgrid/microgriduser.controller.js on lines 3..110
myems-admin/app/controllers/settings/shopfloor/shopfloorequipment.controller.js on lines 3..110
myems-admin/app/controllers/settings/shopfloor/shopfloorsensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/store/storesensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/tenant/tenantsensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/virtualpowerplant/virtualpowerplantmicrogrid.controller.js on lines 3..110

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

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

app.controller('ShopfloorSensorController', function (
    $scope,
    $window,
    $translate,
    ShopfloorService,
myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstationcontainer.controller.js on lines 3..110
myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstationuser.controller.js on lines 3..110
myems-admin/app/controllers/settings/microgrid/microgridsensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/microgrid/microgriduser.controller.js on lines 3..110
myems-admin/app/controllers/settings/shopfloor/shopfloorequipment.controller.js on lines 3..110
myems-admin/app/controllers/settings/store/storesensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/tenant/tenantsensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/virtualpowerplant/virtualpowerplantmicrogrid.controller.js on lines 3..110

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

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

app.controller('EnergyStoragePowerStationUserController', function (
    $scope,
    $window,
    $translate,
    EnergyStoragePowerStationService,
myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstationcontainer.controller.js on lines 3..110
myems-admin/app/controllers/settings/microgrid/microgridsensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/microgrid/microgriduser.controller.js on lines 3..110
myems-admin/app/controllers/settings/shopfloor/shopfloorequipment.controller.js on lines 3..110
myems-admin/app/controllers/settings/shopfloor/shopfloorsensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/store/storesensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/tenant/tenantsensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/virtualpowerplant/virtualpowerplantmicrogrid.controller.js on lines 3..110

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

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

app.controller('StoreSensorController', function (
    $scope,
    $window,
    $translate,
    StoreService,
myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstationcontainer.controller.js on lines 3..110
myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstationuser.controller.js on lines 3..110
myems-admin/app/controllers/settings/microgrid/microgridsensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/microgrid/microgriduser.controller.js on lines 3..110
myems-admin/app/controllers/settings/shopfloor/shopfloorequipment.controller.js on lines 3..110
myems-admin/app/controllers/settings/shopfloor/shopfloorsensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/tenant/tenantsensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/virtualpowerplant/virtualpowerplantmicrogrid.controller.js on lines 3..110

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

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

app.controller('MicrogridSensorController', function (
    $scope,
    $window,
    $translate,
    MicrogridService,
myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstationcontainer.controller.js on lines 3..110
myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstationuser.controller.js on lines 3..110
myems-admin/app/controllers/settings/microgrid/microgriduser.controller.js on lines 3..110
myems-admin/app/controllers/settings/shopfloor/shopfloorequipment.controller.js on lines 3..110
myems-admin/app/controllers/settings/shopfloor/shopfloorsensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/store/storesensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/tenant/tenantsensor.controller.js on lines 3..110
myems-admin/app/controllers/settings/virtualpowerplant/virtualpowerplantmicrogrid.controller.js on lines 3..110

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

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

File jquery-jvectormap-2.0.2.min.js has 2497 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * jVectorMap version 2.0.2
 *
 * Copyright 2011-2014, Kirill Lebedev
 *
Severity: Major
Found in myems-admin/js/plugins/jvectormap/jquery-jvectormap-2.0.2.min.js - About 6 days to fix

    File shopfloor.py has 2489 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import uuid
    from datetime import datetime, timedelta
    import falcon
    import mysql.connector
    import simplejson as json
    Severity: Major
    Found in myems-api/core/shopfloor.py - About 6 days to fix

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

      app.controller('EnergyPlanFileController', function(
          $scope, 
          $window,
          $translate,
          $interval, 
      myems-admin/app/controllers/settings/datasource/datarepairfile.controller.js on lines 3..128
      myems-admin/app/controllers/settings/meter/offlinemeterfile.controller.js on lines 3..128

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

      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

      app.controller('DataRepairFileController', function(
          $scope, 
          $window,
          $translate,
          $interval, 
      myems-admin/app/controllers/settings/energyplanfile/energyplanfile.controller.js on lines 3..128
      myems-admin/app/controllers/settings/meter/offlinemeterfile.controller.js on lines 3..128

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

      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

      app.controller('OfflineMeterFileController', function(
          $scope, 
          $window,
          $translate,
          $interval, 
      myems-admin/app/controllers/settings/datasource/datarepairfile.controller.js on lines 3..128
      myems-admin/app/controllers/settings/energyplanfile/energyplanfile.controller.js on lines 3..128

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

      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 not is_quick_mode:
                  for point in point_list:
                      point_values = []
                      point_timestamps = []
                      if point['object_type'] == 'ENERGY_VALUE':
      Severity: Major
      Found in myems-api/reports/spaceenvironmentmonitor.py and 1 other location - About 6 days to fix
      myems-api/reports/meterrealtime.py on lines 141..207

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

      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 not is_quick_mode:
                  for point in point_list:
                      point_values = []
                      point_timestamps = []
                      if point['object_type'] == 'ENERGY_VALUE':
      Severity: Major
      Found in myems-api/reports/meterrealtime.py and 1 other location - About 6 days to fix
      myems-api/reports/spaceenvironmentmonitor.py on lines 131..197

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

      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

      File store.py has 2407 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import uuid
      from datetime import datetime, timedelta
      import falcon
      import mysql.connector
      import simplejson as json
      Severity: Major
      Found in myems-api/core/store.py - About 6 days to fix

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

            @staticmethod
            def on_get(req, resp, id_):
                if 'API-KEY' not in req.headers or \
                        not isinstance(req.headers['API-KEY'], str) or \
                        len(str.strip(req.headers['API-KEY'])) == 0:
        Severity: Major
        Found in myems-api/core/offlinemeter.py and 1 other location - About 6 days to fix
        myems-api/core/offlinemeter.py on lines 248..324

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

        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

            @staticmethod
            def on_get(req, resp, id_):
                if 'API-KEY' not in req.headers or \
                        not isinstance(req.headers['API-KEY'], str) or \
                        len(str.strip(req.headers['API-KEY'])) == 0:
        Severity: Major
        Found in myems-api/core/offlinemeter.py and 1 other location - About 6 days to fix
        myems-api/core/offlinemeter.py on lines 649..725

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

        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

        Function on_get has a Cognitive Complexity of 321 (exceeds 5 allowed). Consider refactoring.
        Open

            def on_get(req, resp):
                if 'API-KEY' not in req.headers or \
                        not isinstance(req.headers['API-KEY'], str) or \
                        len(str.strip(req.headers['API-KEY'])) == 0:
                    access_control(req)
        Severity: Minor
        Found in myems-api/reports/combinedequipmentefficiency.py - About 6 days to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

                for meter in meter_list:
                    cursor_energy.execute(" SELECT start_datetime_utc, actual_value "
                                          " FROM tbl_meter_hourly "
                                          " WHERE meter_id = %s "
                                          "     AND start_datetime_utc >= %s "
        Severity: Major
        Found in myems-api/reports/energystoragepowerstationreportingenergy.py and 1 other location - About 6 days to fix
        myems-api/reports/energystoragepowerstationreportingrevenue.py on lines 373..436

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

        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

                for meter in meter_list:
                    cursor_billing.execute(" SELECT start_datetime_utc, actual_value "
                                           " FROM tbl_meter_hourly "
                                           " WHERE meter_id = %s "
                                           "     AND start_datetime_utc >= %s "
        Severity: Major
        Found in myems-api/reports/energystoragepowerstationreportingrevenue.py and 1 other location - About 6 days to fix
        myems-api/reports/energystoragepowerstationreportingenergy.py on lines 373..435

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

        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 energy_category_set is not None and len(energy_category_set) > 0:
                    for energy_category_id in energy_category_set:
                        result['reporting_period']['names'].append(energy_category_dict[energy_category_id]['name'])
                        result['reporting_period']['energy_category_ids'].append(energy_category_id)
                        result['reporting_period']['units'].append(config.currency_unit)
        Severity: Major
        Found in myems-api/reports/equipmentcost.py and 1 other location - About 6 days to fix
        myems-api/reports/combinedequipmentcost.py on lines 600..626

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

        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