Showing 10,536 of 10,536 total issues

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 349.

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

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

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

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

Refactorings

Further Reading

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 349.

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

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

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

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

Refactorings

Further Reading

File Fault.js has 818 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { createRef, Fragment, useEffect, useState } from 'react';
import paginationFactory, { PaginationProvider } from 'react-bootstrap-table2-paginator';
import BootstrapTable from 'react-bootstrap-table-next';
import { toast } from 'react-toastify';
import {
Severity: Major
Found in myems-web/src/components/MyEMS/FDD/Fault.js - About 1 day to fix

    File spacesaving.py has 817 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import base64
    from core.utilities import get_translation
    import os
    import uuid
    from decimal import Decimal
    Severity: Major
    Found in myems-api/excelexporters/spacesaving.py - About 1 day to fix

      File spaceplan.py has 817 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import base64
      from core.utilities import get_translation
      import os
      import uuid
      from decimal import Decimal
      Severity: Major
      Found in myems-api/excelexporters/spaceplan.py - About 1 day to fix

        File combinedequipmentefficiency.py has 816 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import re
        from datetime import datetime, timedelta, timezone
        from decimal import Decimal
        import falcon
        import mysql.connector
        Severity: Major
        Found in myems-api/reports/combinedequipmentefficiency.py - About 1 day to fix

          File spaceincome.py has 813 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import base64
          from core.utilities import get_translation
          import os
          import re
          import uuid
          Severity: Major
          Found in myems-api/excelexporters/spaceincome.py - About 1 day to fix

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

                      modalInstance.result.then(function(microgridheatpump) {
                        microgridheatpump.power_point_id = microgridheatpump.power_point.id;
                        microgridheatpump.electricity_meter_id = microgridheatpump.electricity_meter.id;
                        microgridheatpump.heat_meter_id = microgridheatpump.heat_meter.id;
                        microgridheatpump.cooling_meter_id = microgridheatpump.cooling_meter.id;
            myems-admin/app/controllers/settings/microgrid/microgridheatpump.controller.js on lines 133..158

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 344.

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

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

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

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

            Refactorings

            Further Reading

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

                      modalInstance.result.then(function(modifiedMicrogridHeatpump) {
                        modifiedMicrogridHeatpump.power_point_id = modifiedMicrogridHeatpump.power_point.id;
                        modifiedMicrogridHeatpump.electricity_meter_id = modifiedMicrogridHeatpump.electricity_meter.id;
                        modifiedMicrogridHeatpump.heat_meter_id = modifiedMicrogridHeatpump.heat_meter.id;
                        modifiedMicrogridHeatpump.cooling_meter_id = modifiedMicrogridHeatpump.cooling_meter.id;
            myems-admin/app/controllers/settings/microgrid/microgridheatpump.controller.js on lines 86..111

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 344.

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

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

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

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

            Refactorings

            Further Reading

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

                @staticmethod
                @user_logger
                def on_delete(req, resp, id_):
                    admin_control(req)
                    if not id_.isdigit() or int(id_) <= 0:
            Severity: Major
            Found in myems-api/core/emailmessage.py and 3 other locations - About 1 day to fix
            myems-api/core/textmessage.py on lines 426..456
            myems-api/core/user.py on lines 1519..1551
            myems-api/core/wechatmessage.py on lines 475..507

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 210.

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

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

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

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

            Refactorings

            Further Reading

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

                @staticmethod
                @user_logger
                def on_delete(req, resp, id_):
                    admin_control(req)
                    if not id_.isdigit() or int(id_) <= 0:
            Severity: Major
            Found in myems-api/core/textmessage.py and 3 other locations - About 1 day to fix
            myems-api/core/emailmessage.py on lines 457..489
            myems-api/core/user.py on lines 1519..1551
            myems-api/core/wechatmessage.py on lines 475..507

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 210.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 210.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 210.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 210.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 210.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 210.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 210.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 210.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 210.

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

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

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

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

            Refactorings

            Further Reading

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

                @staticmethod
                @user_logger
                def on_delete(req, resp, id_):
                    admin_control(req)
                    if not id_.isdigit() or int(id_) <= 0:
            Severity: Major
            Found in myems-api/core/user.py and 3 other locations - About 1 day to fix
            myems-api/core/emailmessage.py on lines 457..489
            myems-api/core/textmessage.py on lines 426..456
            myems-api/core/wechatmessage.py on lines 475..507

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 210.

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

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

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

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

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language