Showing 10,536 of 10,536 total issues

Function initClass has 425 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    value: function initClass() {
      // Exposing the emitter class, mainly for tests
      this.prototype.Emitter = Emitter;
      /*
       This is a list of all available events you can register on a dropzone object.
Severity: Major
Found in myems-admin/js/plugins/dropzone/dropzone.js - About 2 days to fix

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

            modalInstance.result.then(function(modifiedOfflineMeter) {
                modifiedOfflineMeter.energy_category_id = modifiedOfflineMeter.energy_category.id;
                if (modifiedOfflineMeter.energy_item != null && modifiedOfflineMeter.energy_item.id != null ) {
                    modifiedOfflineMeter.energy_item_id = modifiedOfflineMeter.energy_item.id;
                } else {
    myems-admin/app/controllers/settings/meter/virtualmeter.controller.js on lines 157..187

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

    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

    app.factory('CombinedEquipmentParameterService', function($http) {
        return {
            getParametersByCombinedEquipmentID: function(id, headers, callback) {
                $http.get(getAPI()+'combinedequipments/'+id+'/parameters', {headers})
                .then(function (response) {
    myems-admin/app/services/settings/energyflowdiagram/energyflowdiagramlink.service.js on lines 2..38
    myems-admin/app/services/settings/energyflowdiagram/energyflowdiagramnode.service.js on lines 2..37
    myems-admin/app/services/settings/equipment/equipmentparameter.service.js on lines 2..38

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

    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

    app.factory('EnergyFlowDiagramNodeService', function($http) {
        return {
            getNodesByEnergyFlowDiagramID: function(id, headers, callback) {
                $http.get(getAPI()+'energyflowdiagrams/'+id+'/nodes', {headers})
                .then(function (response) {
    myems-admin/app/services/settings/combinedequipment/combinedequipmentparameter.service.js on lines 2..39
    myems-admin/app/services/settings/energyflowdiagram/energyflowdiagramlink.service.js on lines 2..38
    myems-admin/app/services/settings/equipment/equipmentparameter.service.js on lines 2..38

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

    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(modifiedVirtualMeter) {
                modifiedVirtualMeter.energy_category_id = modifiedVirtualMeter.energy_category.id;
                if (modifiedVirtualMeter.energy_item != null && modifiedVirtualMeter.energy_item.id != null ) {
                    modifiedVirtualMeter.energy_item_id = modifiedVirtualMeter.energy_item.id;
                } else {
    myems-admin/app/controllers/settings/meter/offlinemeter.controller.js on lines 130..160

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

    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

    app.factory('EquipmentParameterService', function($http) {
        return {
    
            getParametersByEquipmentID: function(id, headers, callback) {
                $http.get(getAPI()+'equipments/'+id+'/parameters', {headers})
    myems-admin/app/services/settings/combinedequipment/combinedequipmentparameter.service.js on lines 2..39
    myems-admin/app/services/settings/energyflowdiagram/energyflowdiagramlink.service.js on lines 2..38
    myems-admin/app/services/settings/energyflowdiagram/energyflowdiagramnode.service.js on lines 2..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 375.

    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

    app.factory('EnergyFlowDiagramLinkService', function($http) {
        return {
    
            getLinksByEnergyFlowDiagramID: function(id, headers, callback) {
                $http.get(getAPI()+'energyflowdiagrams/'+id+'/links', {headers})
    myems-admin/app/services/settings/combinedequipment/combinedequipmentparameter.service.js on lines 2..39
    myems-admin/app/services/settings/energyflowdiagram/energyflowdiagramnode.service.js on lines 2..37
    myems-admin/app/services/settings/equipment/equipmentparameter.service.js on lines 2..38

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

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

        if 'parameters' not in report.keys() or \
                report['parameters'] is None or \
                'names' not in report['parameters'].keys() or \
                report['parameters']['names'] is None or \
                len(report['parameters']['names']) == 0 or \
    Severity: Major
    Found in myems-api/excelexporters/combinedequipmentenergyitem.py and 5 other locations - About 2 days to fix
    myems-api/excelexporters/combinedequipmentefficiency.py on lines 311..324
    myems-api/excelexporters/equipmentefficiency.py on lines 306..319
    myems-api/excelexporters/metercomparison.py on lines 400..412
    myems-api/excelexporters/metercomparison.py on lines 414..426
    myems-api/excelexporters/spaceefficiency.py on lines 258..271

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

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

        if 'parameters' not in report.keys() or \
                report['parameters'] is None or \
                'names' not in report['parameters'].keys() or \
                report['parameters']['names'] is None or \
                len(report['parameters']['names']) == 0 or \
    Severity: Major
    Found in myems-api/excelexporters/spaceefficiency.py and 5 other locations - About 2 days to fix
    myems-api/excelexporters/combinedequipmentefficiency.py on lines 311..324
    myems-api/excelexporters/combinedequipmentenergyitem.py on lines 658..671
    myems-api/excelexporters/equipmentefficiency.py on lines 306..319
    myems-api/excelexporters/metercomparison.py on lines 400..412
    myems-api/excelexporters/metercomparison.py on lines 414..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 230.

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

        if 'parameters' not in report.keys() or \
                report['parameters'] is None or \
                'names' not in report['parameters'].keys() or \
                report['parameters']['names'] is None or \
                len(report['parameters']['names']) == 0 or \
    Severity: Major
    Found in myems-api/excelexporters/equipmentefficiency.py and 5 other locations - About 2 days to fix
    myems-api/excelexporters/combinedequipmentefficiency.py on lines 311..324
    myems-api/excelexporters/combinedequipmentenergyitem.py on lines 658..671
    myems-api/excelexporters/metercomparison.py on lines 400..412
    myems-api/excelexporters/metercomparison.py on lines 414..426
    myems-api/excelexporters/spaceefficiency.py on lines 258..271

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

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

        if 'parameters' not in report.keys() or \
                report['parameters'] is None or \
                'names' not in report['parameters'].keys() or \
                report['parameters']['names'] is None or \
                len(report['parameters']['names']) == 0 or \
    Severity: Major
    Found in myems-api/excelexporters/combinedequipmentefficiency.py and 5 other locations - About 2 days to fix
    myems-api/excelexporters/combinedequipmentenergyitem.py on lines 658..671
    myems-api/excelexporters/equipmentefficiency.py on lines 306..319
    myems-api/excelexporters/metercomparison.py on lines 400..412
    myems-api/excelexporters/metercomparison.py on lines 414..426
    myems-api/excelexporters/spaceefficiency.py on lines 258..271

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

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

        if 'parameters1' not in report.keys() or \
                report['parameters1'] is None or \
                'names' not in report['parameters1'].keys() or \
                report['parameters1']['names'] is None or \
                len(report['parameters1']['names']) == 0 or \
    Severity: Major
    Found in myems-api/excelexporters/metercomparison.py and 5 other locations - About 2 days to fix
    myems-api/excelexporters/combinedequipmentefficiency.py on lines 311..324
    myems-api/excelexporters/combinedequipmentenergyitem.py on lines 658..671
    myems-api/excelexporters/equipmentefficiency.py on lines 306..319
    myems-api/excelexporters/metercomparison.py on lines 414..426
    myems-api/excelexporters/spaceefficiency.py on lines 258..271

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

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

        if 'parameters2' not in report.keys() or \
                report['parameters2'] is None or \
                'names' not in report['parameters2'].keys() or \
                report['parameters2']['names'] is None or \
                len(report['parameters2']['names']) == 0 or \
    Severity: Major
    Found in myems-api/excelexporters/metercomparison.py and 5 other locations - About 2 days to fix
    myems-api/excelexporters/combinedequipmentefficiency.py on lines 311..324
    myems-api/excelexporters/combinedequipmentenergyitem.py on lines 658..671
    myems-api/excelexporters/equipmentefficiency.py on lines 306..319
    myems-api/excelexporters/metercomparison.py on lines 400..412
    myems-api/excelexporters/spaceefficiency.py on lines 258..271

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

    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 storeenergycategory.py has 874 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/storeenergycategory.py - About 2 days to fix

      File equipmentefficiency.py has 873 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/equipmentefficiency.py - About 2 days to fix

        File shopfloorenergycategory.py has 872 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/shopfloorenergycategory.py - About 2 days to fix

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

          def get_energy_item_tariffs(energy_item_id, start_datetime_utc, end_datetime_utc):
              # todo: verify parameters
              # todo: add start_datetime_utc and end_datetime_utc to factor
              # get timezone offset in minutes, this value will be returned to client
              timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6])
          Severity: Major
          Found in myems-aggregation/carbon_dioxide_emmision_factor.py and 1 other location - About 2 days to fix
          myems-aggregation/carbon_dioxide_emmision_factor.py on lines 9..43

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

          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 not is_quick_mode:
                      if config.is_tariff_appended and energy_item_set is not None and len(energy_item_set) > 0:
                          for energy_item_id in energy_item_set:
                              energy_category_tariff_dict = \
                                  utilities.get_energy_category_tariffs(equipment['cost_center_id'],
          Severity: Major
          Found in myems-api/reports/equipmentenergyitem.py and 1 other location - About 2 days to fix
          myems-api/reports/combinedequipmentenergyitem.py on lines 432..450

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

          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 not is_quick_mode:
                      if config.is_tariff_appended and energy_item_set is not None and len(energy_item_set) > 0:
                          for energy_item_id in energy_item_set:
                              energy_category_tariff_dict = \
                                  utilities.get_energy_category_tariffs(combined_equipment['cost_center_id'],
          Severity: Major
          Found in myems-api/reports/combinedequipmentenergyitem.py and 1 other location - About 2 days to fix
          myems-api/reports/equipmentenergyitem.py on lines 413..431

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

          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

          def get_energy_category_factor(energy_category_id, start_datetime_utc, end_datetime_utc):
              # todo: verify parameters
              # todo: add start_datetime_utc and end_datetime_utc to factor
              # get timezone offset in minutes, this value will be returned to client
              timezone_offset = int(config.utc_offset[1:3]) * 60 + int(config.utc_offset[4:6])
          Severity: Major
          Found in myems-aggregation/carbon_dioxide_emmision_factor.py and 1 other location - About 2 days to fix
          myems-aggregation/carbon_dioxide_emmision_factor.py on lines 49..83

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

          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