Showing 10,536 of 10,536 total issues

File metercarbon.py has 429 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: Minor
Found in myems-api/reports/metercarbon.py - About 6 hrs to fix

    File metercost.py has 429 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: Minor
    Found in myems-api/reports/metercost.py - About 6 hrs to fix

      Function link has 157 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  link: function (scope, element, attrs, ngModel) {
                      var format = attrs.format || dateTimeConfig.format,
                          parentForm = element.inheritedData('$formController'),
                          views = $parse(attrs.views)(scope) || dateTimeConfig.views.concat(),
                          view = attrs.view || views[0],
      Severity: Major
      Found in myems-admin/js/plugins/datapicker/angular-datepicker.js - About 6 hrs to fix

        Function addEnergyStorageContainerBattery has 157 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              $scope.addEnergyStorageContainerBattery = function() {
        
                  var modalInstance = $uibModal.open({
                      templateUrl: 'views/settings/energystoragecontainer/energystoragecontainerbattery.model.html',
                      controller: 'ModalAddEnergyStorageContainerBatteryCtrl',

          Function ExifRestore has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
          Open

          function () {
            function ExifRestore() {
              _classCallCheck(this, ExifRestore);
            }
          
          
          Severity: Minor
          Found in myems-admin/js/plugins/dropzone/dropzone.js - About 6 hrs to fix

          Cognitive Complexity

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

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

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

          Further reading

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

            const options = {
              scales: {
                x: {
                  display: true,
                  ticks: {
          myems-web/src/components/MyEMS/EnergyStoragePowerStation/StackBarChart.js on lines 57..88
          myems-web/src/components/MyEMS/Microgrid/StackBarChart.js on lines 67..98

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

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

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

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

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

          Refactorings

          Further Reading

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

            const options = {
              scales: {
                x: {
                  display: true,
                  ticks: {
          Severity: Major
          Found in myems-web/src/components/MyEMS/Microgrid/StackBarChart.js and 2 other locations - About 6 hrs to fix
          myems-web/src/components/MyEMS/EnergyStoragePowerStation/StackBarChart.js on lines 57..88
          myems-web/src/components/MyEMS/common/ChartSpacesStackBar.js on lines 78..109

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

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

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

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

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

          Refactorings

          Further Reading

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

            const options = {
              scales: {
                x: {
                  display: true,
                  ticks: {
          myems-web/src/components/MyEMS/Microgrid/StackBarChart.js on lines 67..98
          myems-web/src/components/MyEMS/common/ChartSpacesStackBar.js on lines 78..109

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

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

                      if 'id' in link['source_node'].keys():
                          if link['source_node']['id'] is not None and \
                                  link['source_node']['id'] <= 0:
                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                     description='API.INVALID_SOURCE_NODE_ID')
          Severity: Major
          Found in myems-api/core/energyflowdiagram.py and 9 other locations - About 6 hrs to fix
          myems-api/core/combinedequipment.py on lines 955..960
          myems-api/core/combinedequipment.py on lines 1335..1340
          myems-api/core/energyflowdiagram.py on lines 519..524
          myems-api/core/energyflowdiagram.py on lines 527..532
          myems-api/core/energyflowdiagram.py on lines 819..824
          myems-api/core/energyflowdiagram.py on lines 827..832
          myems-api/core/energyflowdiagram.py on lines 1447..1452
          myems-api/core/equipment.py on lines 798..803
          myems-api/core/equipment.py on lines 1166..1171

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

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

                      if 'id' in link['target_node'].keys():
                          if link['target_node']['id'] is not None and \
                                  link['target_node']['id'] <= 0:
                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                     description='API.INVALID_TARGET_NODE_ID')
          Severity: Major
          Found in myems-api/core/energyflowdiagram.py and 9 other locations - About 6 hrs to fix
          myems-api/core/combinedequipment.py on lines 955..960
          myems-api/core/combinedequipment.py on lines 1335..1340
          myems-api/core/energyflowdiagram.py on lines 519..524
          myems-api/core/energyflowdiagram.py on lines 527..532
          myems-api/core/energyflowdiagram.py on lines 819..824
          myems-api/core/energyflowdiagram.py on lines 827..832
          myems-api/core/energyflowdiagram.py on lines 1439..1444
          myems-api/core/equipment.py on lines 798..803
          myems-api/core/equipment.py on lines 1166..1171

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

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

                  if 'source_node_id' in new_values['data'].keys():
                      if new_values['data']['source_node_id'] is not None and \
                              new_values['data']['source_node_id'] <= 0:
                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                 description='API.INVALID_SOURCE_NODE_ID')
          Severity: Major
          Found in myems-api/core/energyflowdiagram.py and 9 other locations - About 6 hrs to fix
          myems-api/core/combinedequipment.py on lines 955..960
          myems-api/core/combinedequipment.py on lines 1335..1340
          myems-api/core/energyflowdiagram.py on lines 519..524
          myems-api/core/energyflowdiagram.py on lines 527..532
          myems-api/core/energyflowdiagram.py on lines 827..832
          myems-api/core/energyflowdiagram.py on lines 1439..1444
          myems-api/core/energyflowdiagram.py on lines 1447..1452
          myems-api/core/equipment.py on lines 798..803
          myems-api/core/equipment.py on lines 1166..1171

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

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

                  if 'target_node_id' in new_values['data'].keys():
                      if new_values['data']['target_node_id'] is not None and \
                              new_values['data']['target_node_id'] <= 0:
                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                 description='API.INVALID_TARGET_NODE_ID')
          Severity: Major
          Found in myems-api/core/energyflowdiagram.py and 9 other locations - About 6 hrs to fix
          myems-api/core/combinedequipment.py on lines 955..960
          myems-api/core/combinedequipment.py on lines 1335..1340
          myems-api/core/energyflowdiagram.py on lines 519..524
          myems-api/core/energyflowdiagram.py on lines 527..532
          myems-api/core/energyflowdiagram.py on lines 819..824
          myems-api/core/energyflowdiagram.py on lines 1439..1444
          myems-api/core/energyflowdiagram.py on lines 1447..1452
          myems-api/core/equipment.py on lines 798..803
          myems-api/core/equipment.py on lines 1166..1171

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

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

                  if 'source_node_id' in new_values['data'].keys():
                      if new_values['data']['source_node_id'] is not None and \
                              new_values['data']['source_node_id'] <= 0:
                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                 description='API.INVALID_SOURCE_NODE_ID')
          Severity: Major
          Found in myems-api/core/energyflowdiagram.py and 9 other locations - About 6 hrs to fix
          myems-api/core/combinedequipment.py on lines 955..960
          myems-api/core/combinedequipment.py on lines 1335..1340
          myems-api/core/energyflowdiagram.py on lines 527..532
          myems-api/core/energyflowdiagram.py on lines 819..824
          myems-api/core/energyflowdiagram.py on lines 827..832
          myems-api/core/energyflowdiagram.py on lines 1439..1444
          myems-api/core/energyflowdiagram.py on lines 1447..1452
          myems-api/core/equipment.py on lines 798..803
          myems-api/core/equipment.py on lines 1166..1171

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

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

                  if 'point_id' in new_values['data'].keys():
                      if new_values['data']['point_id'] is not None and \
                              new_values['data']['point_id'] <= 0:
                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                 description='API.INVALID_POINT_ID')
          Severity: Major
          Found in myems-api/core/equipment.py and 9 other locations - About 6 hrs to fix
          myems-api/core/combinedequipment.py on lines 955..960
          myems-api/core/combinedequipment.py on lines 1335..1340
          myems-api/core/energyflowdiagram.py on lines 519..524
          myems-api/core/energyflowdiagram.py on lines 527..532
          myems-api/core/energyflowdiagram.py on lines 819..824
          myems-api/core/energyflowdiagram.py on lines 827..832
          myems-api/core/energyflowdiagram.py on lines 1439..1444
          myems-api/core/energyflowdiagram.py on lines 1447..1452
          myems-api/core/equipment.py on lines 1166..1171

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

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

                  if 'point_id' in new_values['data'].keys():
                      if new_values['data']['point_id'] is not None and \
                              new_values['data']['point_id'] <= 0:
                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                 description='API.INVALID_POINT_ID')
          Severity: Major
          Found in myems-api/core/combinedequipment.py and 9 other locations - About 6 hrs to fix
          myems-api/core/combinedequipment.py on lines 1335..1340
          myems-api/core/energyflowdiagram.py on lines 519..524
          myems-api/core/energyflowdiagram.py on lines 527..532
          myems-api/core/energyflowdiagram.py on lines 819..824
          myems-api/core/energyflowdiagram.py on lines 827..832
          myems-api/core/energyflowdiagram.py on lines 1439..1444
          myems-api/core/energyflowdiagram.py on lines 1447..1452
          myems-api/core/equipment.py on lines 798..803
          myems-api/core/equipment.py on lines 1166..1171

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

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

                  if 'target_node_id' in new_values['data'].keys():
                      if new_values['data']['target_node_id'] is not None and \
                              new_values['data']['target_node_id'] <= 0:
                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                 description='API.INVALID_TARGET_NODE_ID')
          Severity: Major
          Found in myems-api/core/energyflowdiagram.py and 9 other locations - About 6 hrs to fix
          myems-api/core/combinedequipment.py on lines 955..960
          myems-api/core/combinedequipment.py on lines 1335..1340
          myems-api/core/energyflowdiagram.py on lines 519..524
          myems-api/core/energyflowdiagram.py on lines 819..824
          myems-api/core/energyflowdiagram.py on lines 827..832
          myems-api/core/energyflowdiagram.py on lines 1439..1444
          myems-api/core/energyflowdiagram.py on lines 1447..1452
          myems-api/core/equipment.py on lines 798..803
          myems-api/core/equipment.py on lines 1166..1171

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

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

                  if 'point_id' in new_values['data'].keys():
                      if new_values['data']['point_id'] is not None and \
                              new_values['data']['point_id'] <= 0:
                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                 description='API.INVALID_POINT_ID')
          Severity: Major
          Found in myems-api/core/equipment.py and 9 other locations - About 6 hrs to fix
          myems-api/core/combinedequipment.py on lines 955..960
          myems-api/core/combinedequipment.py on lines 1335..1340
          myems-api/core/energyflowdiagram.py on lines 519..524
          myems-api/core/energyflowdiagram.py on lines 527..532
          myems-api/core/energyflowdiagram.py on lines 819..824
          myems-api/core/energyflowdiagram.py on lines 827..832
          myems-api/core/energyflowdiagram.py on lines 1439..1444
          myems-api/core/energyflowdiagram.py on lines 1447..1452
          myems-api/core/equipment.py on lines 798..803

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

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

                  if 'point_id' in new_values['data'].keys():
                      if new_values['data']['point_id'] is not None and \
                              new_values['data']['point_id'] <= 0:
                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                 description='API.INVALID_POINT_ID')
          Severity: Major
          Found in myems-api/core/combinedequipment.py and 9 other locations - About 6 hrs to fix
          myems-api/core/combinedequipment.py on lines 955..960
          myems-api/core/energyflowdiagram.py on lines 519..524
          myems-api/core/energyflowdiagram.py on lines 527..532
          myems-api/core/energyflowdiagram.py on lines 819..824
          myems-api/core/energyflowdiagram.py on lines 827..832
          myems-api/core/energyflowdiagram.py on lines 1439..1444
          myems-api/core/energyflowdiagram.py on lines 1447..1452
          myems-api/core/equipment.py on lines 798..803
          myems-api/core/equipment.py on lines 1166..1171

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

          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

                  result = {"id": row[0],
                            "host": row[1],
                            "port": row[2],
                            "requires_authentication": bool(row[3]),
                            "user_name": row[4],
          Severity: Major
          Found in myems-api/core/emailserver.py and 1 other location - About 6 hrs to fix
          myems-api/core/emailserver.py on lines 35..42

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

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

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

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

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

          Refactorings

          Further Reading

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

                          meta_result = {"id": row[0],
                                         "host": row[1],
                                         "port": row[2],
                                         "requires_authentication": bool(row[3]),
                                         "user_name": row[4],
          Severity: Major
          Found in myems-api/core/emailserver.py and 1 other location - About 6 hrs to fix
          myems-api/core/emailserver.py on lines 173..180

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

          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