Showing 4,754 of 10,533 total issues

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

        if 'data' not in new_values['data'] or \
                not isinstance(new_values['data']['data'], str) or \
                len(str.strip(new_values['data']['data'])) == 0:
            raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
Severity: Major
Found in myems-api/core/privilege.py and 7 other locations - About 5 hrs to fix
myems-api/core/privilege.py on lines 54..57
myems-api/core/privilege.py on lines 61..64
myems-api/core/privilege.py on lines 160..163
myems-api/core/user.py on lines 728..731
myems-api/core/user.py on lines 739..742
myems-api/core/user.py on lines 856..859
myems-api/core/user.py on lines 863..866

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

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

        if 'new_password' not in new_values['data'] or \
                not isinstance(new_values['data']['new_password'], str) or \
                len(str.strip(new_values['data']['new_password'])) == 0:
            raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
Severity: Major
Found in myems-api/core/user.py and 7 other locations - About 5 hrs to fix
myems-api/core/privilege.py on lines 54..57
myems-api/core/privilege.py on lines 61..64
myems-api/core/privilege.py on lines 160..163
myems-api/core/privilege.py on lines 167..170
myems-api/core/user.py on lines 728..731
myems-api/core/user.py on lines 856..859
myems-api/core/user.py on lines 863..866

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

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

            for point in meta_result['points']:
                cursor.execute(" SELECT name "
                               " FROM tbl_points "
                               " WHERE id = %s ", (point['id'],))
                if cursor.fetchone() is None:
Severity: Major
Found in myems-api/core/sensor.py and 1 other location - About 5 hrs to fix
myems-api/core/sensor.py on lines 592..604

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

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

        {isSelected ? (
          <InputGroup size="sm" className="input-group input-group-sm">
            <CustomInput type="select" id="bulk-select">
              <option>Bulk actions</option>
              <option value="Refund">Refund</option>
Severity: Major
Found in myems-web/src/components/widgets/RecentPuchasesTable.js and 1 other location - About 5 hrs to fix
myems-web/src/components/e-commerce/Orders.js on lines 207..231

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

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

        {isSelected ? (
          <InputGroup size="sm" className="input-group input-group-sm">
            <CustomInput type="select" id="bulk-select">
              <option>Bulk actions</option>
              <option value="Refund">Refund</option>
Severity: Major
Found in myems-web/src/components/e-commerce/Orders.js and 1 other location - About 5 hrs to fix
myems-web/src/components/widgets/RecentPuchasesTable.js on lines 13..37

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

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

export const storeRoutes = {
  name: 'Store Data',
  to: '/store',
  icon: 'shopping-bag',
  children: [
Severity: Major
Found in myems-web/src/routes.js and 1 other location - About 5 hrs to fix
myems-web/src/routes.js on lines 428..443

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

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

export const shopfloorRoutes = {
  name: 'Shopfloor Data',
  to: '/shopfloor',
  icon: 'industry',
  children: [
Severity: Major
Found in myems-web/src/routes.js and 1 other location - About 5 hrs to fix
myems-web/src/routes.js on lines 411..426

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

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

            if rows is not None and len(rows) > 0:
                for row in rows:
                    result = {"id": row[0], "name": row[1], "data_source": data_source_dict.get(row[2], None)}
                    point_result.append(result)
                meta_result['points'] = point_result
Severity: Major
Found in myems-api/core/space.py and 5 other locations - About 5 hrs to fix
myems-api/core/shopfloor.py on lines 2123..2127
myems-api/core/shopfloor.py on lines 2684..2688
myems-api/core/space.py on lines 4791..4795
myems-api/core/store.py on lines 2061..2065
myems-api/core/store.py on lines 2599..2603

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

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

            if rows is not None and len(rows) > 0:
                for row in rows:
                    result = {"id": row[0], "name": row[1], "data_source": data_source_dict.get(row[2], None)}
                    point_result.append(result)
                meta_result['points'] = point_result
Severity: Major
Found in myems-api/core/store.py and 5 other locations - About 5 hrs to fix
myems-api/core/shopfloor.py on lines 2123..2127
myems-api/core/shopfloor.py on lines 2684..2688
myems-api/core/space.py on lines 3879..3883
myems-api/core/space.py on lines 4791..4795
myems-api/core/store.py on lines 2599..2603

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

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

            if rows is not None and len(rows) > 0:
                for row in rows:
                    result = {"id": row[0], "name": row[1], "data_source": data_source_dict.get(row[2], None)}
                    point_result.append(result)
                meta_result['points'] = point_result
Severity: Major
Found in myems-api/core/shopfloor.py and 5 other locations - About 5 hrs to fix
myems-api/core/shopfloor.py on lines 2123..2127
myems-api/core/space.py on lines 3879..3883
myems-api/core/space.py on lines 4791..4795
myems-api/core/store.py on lines 2061..2065
myems-api/core/store.py on lines 2599..2603

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

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

            if rows is not None and len(rows) > 0:
                for row in rows:
                    result = {"id": row[0], "name": row[1], "data_source": data_source_dict.get(row[2], None)}
                    point_result.append(result)
                meta_result['points'] = point_result
Severity: Major
Found in myems-api/core/space.py and 5 other locations - About 5 hrs to fix
myems-api/core/shopfloor.py on lines 2123..2127
myems-api/core/shopfloor.py on lines 2684..2688
myems-api/core/space.py on lines 3879..3883
myems-api/core/store.py on lines 2061..2065
myems-api/core/store.py on lines 2599..2603

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

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

            if rows is not None and len(rows) > 0:
                for row in rows:
                    result = {"id": row[0], "name": row[1], "data_source": data_source_dict.get(row[2], None)}
                    point_result.append(result)
                meta_result['points'] = point_result
Severity: Major
Found in myems-api/core/store.py and 5 other locations - About 5 hrs to fix
myems-api/core/shopfloor.py on lines 2123..2127
myems-api/core/shopfloor.py on lines 2684..2688
myems-api/core/space.py on lines 3879..3883
myems-api/core/space.py on lines 4791..4795
myems-api/core/store.py on lines 2061..2065

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_discharge_carbon'] = Decimal(0.0)
            for row in rows_energy_storage_power_stations_subtotal_discharge_carbon:
                if row[0] == energy_storage_power_station['id']:
                    energy_storage_power_station['subtotal_discharge_carbon'] = 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 202..209
myems-api/reports/energystoragepowerstationdashboard.py on lines 222..229
myems-api/reports/energystoragepowerstationdashboard.py on lines 241..248
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_carbon'] = Decimal(0.0)
            for row in rows_microgrids_subtotal_discharge_carbon:
                if row[0] == microgrid['id']:
                    microgrid['subtotal_discharge_carbon'] = 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 281..288
myems-api/reports/microgriddashboard.py on lines 300..307

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_carbon'] = Decimal(0.0)
            for row in rows_microgrids_subtotal_charge_carbon:
                if row[0] == microgrid['id']:
                    microgrid['subtotal_charge_carbon'] = 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 281..288
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_billing'] = Decimal(0.0)
            for row in rows_microgrids_subtotal_charge_billing:
                if row[0] == microgrid['id']:
                    microgrid['subtotal_charge_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 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_carbon'] = Decimal(0.0)
            for row in rows_energy_storage_power_stations_subtotal_charge_carbon:
                if row[0] == energy_storage_power_station['id']:
                    energy_storage_power_station['subtotal_charge_carbon'] = 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 202..209
myems-api/reports/energystoragepowerstationdashboard.py on lines 222..229
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

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

            if rows is not None and len(rows) > 0:
                for row in rows:
                    result = {"id": row[0], "name": row[1], "data_source": data_source_dict.get(row[2], None)}
                    point_result.append(result)
                meta_result['points'] = point_result
Severity: Major
Found in myems-api/core/shopfloor.py and 5 other locations - About 5 hrs to fix
myems-api/core/shopfloor.py on lines 2684..2688
myems-api/core/space.py on lines 3879..3883
myems-api/core/space.py on lines 4791..4795
myems-api/core/store.py on lines 2061..2065
myems-api/core/store.py on lines 2599..2603

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_discharge_energy'] = Decimal(0.0)
            for row in rows_energy_storage_power_stations_subtotal_discharge_energy:
                if row[0] == energy_storage_power_station['id']:
                    energy_storage_power_station['subtotal_discharge_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 162..169
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 energy_storage_power_station in energy_storage_power_station_list:
            energy_storage_power_station['subtotal_discharge_billing'] = Decimal(0.0)
            for row in rows_energy_storage_power_stations_subtotal_discharge_billing:
                if row[0] == energy_storage_power_station['id']:
                    energy_storage_power_station['subtotal_discharge_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 202..209
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

Severity
Category
Status
Source
Language