Showing 4,754 of 10,533 total issues

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

                if is_online:
                    query = (" SELECT tescg.power_point_id "
                             " FROM tbl_energy_storage_power_stations_containers tespsesc, "
                             "      tbl_energy_storage_containers_grids tescg "
                             " WHERE tespsesc.energy_storage_power_station_id = %s "
Severity: Major
Found in myems-api/reports/energystoragepowerstationlist.py and 8 other locations - About 6 hrs to fix
myems-api/reports/energystoragepowerstationlist.py on lines 122..133
myems-api/reports/energystoragepowerstationlist.py on lines 167..178
myems-api/reports/energystoragepowerstationlist.py on lines 240..251
myems-api/reports/microgridlist.py on lines 118..127
myems-api/reports/microgridlist.py on lines 156..166
myems-api/reports/microgridlist.py on lines 201..210
myems-api/reports/microgridlist.py on lines 214..223
myems-api/reports/microgridlist.py on lines 227..236

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

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

                if is_online:
                    query = (" SELECT battery_state_point_id "
                             " FROM tbl_microgrids_batteries "
                             " WHERE microgrid_id = %s "
                             " LIMIT 1 ")
Severity: Major
Found in myems-api/reports/microgridlist.py and 8 other locations - About 6 hrs to fix
myems-api/reports/energystoragepowerstationlist.py on lines 122..133
myems-api/reports/energystoragepowerstationlist.py on lines 167..178
myems-api/reports/energystoragepowerstationlist.py on lines 225..236
myems-api/reports/energystoragepowerstationlist.py on lines 240..251
myems-api/reports/microgridlist.py on lines 118..127
myems-api/reports/microgridlist.py on lines 201..210
myems-api/reports/microgridlist.py on lines 214..223
myems-api/reports/microgridlist.py on lines 227..236

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

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

                if is_online:
                    query = (" SELECT tescpcs.run_state_point_id "
                             " FROM tbl_energy_storage_power_stations_containers tespsesc, "
                             "     tbl_energy_storage_containers_power_conversion_systems tescpcs "
                             " WHERE tespsesc.energy_storage_power_station_id  = %s "
Severity: Major
Found in myems-api/reports/energystoragepowerstationlist.py and 8 other locations - About 6 hrs to fix
myems-api/reports/energystoragepowerstationlist.py on lines 167..178
myems-api/reports/energystoragepowerstationlist.py on lines 225..236
myems-api/reports/energystoragepowerstationlist.py on lines 240..251
myems-api/reports/microgridlist.py on lines 118..127
myems-api/reports/microgridlist.py on lines 156..166
myems-api/reports/microgridlist.py on lines 201..210
myems-api/reports/microgridlist.py on lines 214..223
myems-api/reports/microgridlist.py on lines 227..236

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

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

            try:
                update_row = (" UPDATE tbl_data_repair_files "
                              " SET status = %s "
                              " WHERE id = %s ")
                cursor.execute(update_row, ('done' if is_valid_file else 'error', excel_file['id'],))
Severity: Major
Found in myems-normalization/datarepair.py and 1 other location - About 6 hrs to fix
myems-normalization/offlinemeter.py on lines 295..309

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

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

            try:
                update_row = (" UPDATE tbl_offline_meter_files "
                              " SET status = %s "
                              " WHERE id = %s ")
                cursor.execute(update_row, ('done' if is_valid_file else 'error', excel_file['id'],))
Severity: Major
Found in myems-normalization/offlinemeter.py and 1 other location - About 6 hrs to fix
myems-normalization/datarepair.py on lines 306..320

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

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

                if is_online:
                    query = (" SELECT tescb.battery_state_point_id "
                             " FROM tbl_energy_storage_power_stations_containers tespsesc, "
                             "      tbl_energy_storage_containers_batteries tescb "
                             " WHERE tespsesc.energy_storage_power_station_id = %s "
Severity: Major
Found in myems-api/reports/energystoragepowerstationlist.py and 8 other locations - About 6 hrs to fix
myems-api/reports/energystoragepowerstationlist.py on lines 122..133
myems-api/reports/energystoragepowerstationlist.py on lines 225..236
myems-api/reports/energystoragepowerstationlist.py on lines 240..251
myems-api/reports/microgridlist.py on lines 118..127
myems-api/reports/microgridlist.py on lines 156..166
myems-api/reports/microgridlist.py on lines 201..210
myems-api/reports/microgridlist.py on lines 214..223
myems-api/reports/microgridlist.py on lines 227..236

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

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

    $scope.ok = function () {
        if ($scope.user.is_admin) {
            $scope.user.privilege_id = undefined;
        }else {
            $scope.user.is_read_only = undefined;
Severity: Major
Found in myems-admin/app/controllers/users/user/user.controller.js and 1 other location - About 6 hrs to fix
myems-admin/app/controllers/users/user/user.controller.js on lines 478..487

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

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

    $scope.ok = function () {
        if ($scope.user.is_admin) {
            $scope.user.privilege_id = undefined;
        }else {
            $scope.user.is_read_only = undefined;
Severity: Major
Found in myems-admin/app/controllers/users/user/user.controller.js and 1 other location - About 6 hrs to fix
myems-admin/app/controllers/users/user/user.controller.js on lines 374..383

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

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

            meta_result = {"id": row[0],
                           "name": row[1],
                           "token": row[2],
                           "created_datetime_utc": (row[3].replace(tzinfo=timezone.utc)
                                                    + timedelta(minutes=timezone_offset))
Severity: Major
Found in myems-api/core/apikey.py and 1 other location - About 6 hrs to fix
myems-api/core/apikey.py on lines 38..45

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

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

                token_list.append({"id": row[0],
                                   "name": row[1],
                                   "token": row[2],
                                   "created_datetime_utc": (row[3].replace(tzinfo=timezone.utc)
                                                            + timedelta(minutes=timezone_offset))
Severity: Major
Found in myems-api/core/apikey.py and 1 other location - About 6 hrs to fix
myems-api/core/apikey.py on lines 139..146

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

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

                meta_result = {"id": row[0],
                               "name": row[1],
                               "uuid": row[2],
                               "cost_center": cost_center_dict.get(row[3], None),
                               "balancing_price_point": point_dict.get(row[4], None),
Severity: Major
Found in myems-api/core/virtualpowerplant.py and 1 other location - About 6 hrs to fix
myems-api/core/virtualpowerplant.py on lines 266..277

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

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

        if row is None:
            raise falcon.HTTPError(status=falcon.HTTP_404, title='API.NOT_FOUND',
                                   description='API.VIRTUAL_POWER_PLANT_NOT_FOUND')
        else:
            meta_result = {"id": row[0],
Severity: Major
Found in myems-api/core/virtualpowerplant.py and 1 other location - About 6 hrs to fix
myems-api/core/virtualpowerplant.py on lines 74..81

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

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 SharePieItem = ({ color, name, value, totalShare }) => (
  <Flex justify="between" align="center" className="mb-1">
    <Flex align="center">
      <Dot style={{ backgroundColor: color }} />
      <span className="font-weight-semi-bold">{name}</span>
Severity: Major
Found in myems-web/src/components/MyEMS/common/SharePieItem.js and 1 other location - About 5 hrs to fix
myems-web/src/components/dashboard-alt/MarketShareItem.js on lines 6..14

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

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 MarketShareItem = ({ color, name, value, totalShare }) => (
  <Flex justify="between" align="center" className="mb-1">
    <Flex align="center">
      <Dot style={{ backgroundColor: color }} />
      <span className="font-weight-semi-bold">{name}</span>
Severity: Major
Found in myems-web/src/components/dashboard-alt/MarketShareItem.js and 1 other location - About 5 hrs to fix
myems-web/src/components/MyEMS/common/SharePieItem.js on lines 6..14

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

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

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 97.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

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

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 97.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

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

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 97.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

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

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 97.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

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

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 97.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

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

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 97.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language