myems-api/core/energyflowdiagram.py

Summary

Maintainability
F
1 mo
Test Coverage

File energyflowdiagram.py has 1451 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import uuid
from datetime import datetime, timedelta
import falcon
import mysql.connector
import simplejson as json
Severity: Major
Found in myems-api/core/energyflowdiagram.py - About 3 days to fix

    Function on_post has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_post(req, resp):
            """Handles POST requests"""
            admin_control(req)
            try:
                raw_json = req.stream.read().decode('utf-8')
    Severity: Minor
    Found in myems-api/core/energyflowdiagram.py - About 1 day 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

    Function on_post has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_post(req, resp, id_):
            if 'API-KEY' not in req.headers or \
                    not isinstance(req.headers['API-KEY'], str) or \
                    len(str.strip(req.headers['API-KEY'])) == 0:
                access_control(req)
    Severity: Minor
    Found in myems-api/core/energyflowdiagram.py - About 1 day 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

    Function on_get has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_get(req, resp):
            if 'API-KEY' not in req.headers or \
                    not isinstance(req.headers['API-KEY'], str) or \
                    len(str.strip(req.headers['API-KEY'])) == 0:
                access_control(req)
    Severity: Minor
    Found in myems-api/core/energyflowdiagram.py - About 5 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

    Function on_get has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_get(req, resp, id_):
            if 'API-KEY' not in req.headers or \
                    not isinstance(req.headers['API-KEY'], str) or \
                    len(str.strip(req.headers['API-KEY'])) == 0:
                access_control(req)
    Severity: Minor
    Found in myems-api/core/energyflowdiagram.py - About 5 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

    Function on_get has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_get(req, resp, id_):
            if 'API-KEY' not in req.headers or \
                    not isinstance(req.headers['API-KEY'], str) or \
                    len(str.strip(req.headers['API-KEY'])) == 0:
                access_control(req)
    Severity: Minor
    Found in myems-api/core/energyflowdiagram.py - About 5 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

    Function on_put has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_put(req, resp, id_, lid):
            """Handles PUT requests"""
            admin_control(req)
            if not id_.isdigit() or int(id_) <= 0:
                raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
    Severity: Minor
    Found in myems-api/core/energyflowdiagram.py - About 4 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

    Function on_get has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_get(req, resp, id_):
            if 'API-KEY' not in req.headers or \
                    not isinstance(req.headers['API-KEY'], str) or \
                    len(str.strip(req.headers['API-KEY'])) == 0:
                access_control(req)
    Severity: Minor
    Found in myems-api/core/energyflowdiagram.py - About 4 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

    Function on_post has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_post(req, resp, id_):
            """Handles POST requests"""
            admin_control(req)
            if not id_.isdigit() or int(id_) <= 0:
                raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
    Severity: Minor
    Found in myems-api/core/energyflowdiagram.py - About 4 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

    Function on_get has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_get(req, resp, id_, lid):
            access_control(req)
            if not id_.isdigit() or int(id_) <= 0:
                raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                       description='API.INVALID_ENERGY_FLOW_DIAGRAM_ID')
    Severity: Minor
    Found in myems-api/core/energyflowdiagram.py - About 3 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

    Function on_put has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def on_put(req, resp, id_, lid):
            """Handles PUT requests"""
            admin_control(req)
            if not id_.isdigit() or int(id_) <= 0:
                raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
    Severity: Minor
    Found in myems-api/core/energyflowdiagram.py - About 1 hr to fix

      Function on_post has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def on_post(req, resp, id_):
              """Handles POST requests"""
              admin_control(req)
              if not id_.isdigit() or int(id_) <= 0:
                  raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
      Severity: Minor
      Found in myems-api/core/energyflowdiagram.py - About 1 hr to fix

        Function on_get has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def on_get(req, resp, id_):
                if 'API-KEY' not in req.headers or \
                        not isinstance(req.headers['API-KEY'], str) or \
                        len(str.strip(req.headers['API-KEY'])) == 0:
                    access_control(req)
        Severity: Minor
        Found in myems-api/core/energyflowdiagram.py - About 1 hr to fix

          Function on_get has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def on_get(req, resp):
                  if 'API-KEY' not in req.headers or \
                          not isinstance(req.headers['API-KEY'], str) or \
                          len(str.strip(req.headers['API-KEY'])) == 0:
                      access_control(req)
          Severity: Minor
          Found in myems-api/core/energyflowdiagram.py - About 1 hr to fix

            Function on_get has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def on_get(req, resp, id_):
                    if 'API-KEY' not in req.headers or \
                            not isinstance(req.headers['API-KEY'], str) or \
                            len(str.strip(req.headers['API-KEY'])) == 0:
                        access_control(req)
            Severity: Minor
            Found in myems-api/core/energyflowdiagram.py - About 1 hr to fix

              Function on_get has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def on_get(req, resp, id_):
                      if 'API-KEY' not in req.headers or \
                              not isinstance(req.headers['API-KEY'], str) or \
                              len(str.strip(req.headers['API-KEY'])) == 0:
                          access_control(req)
              Severity: Minor
              Found in myems-api/core/energyflowdiagram.py - About 1 hr to fix

                Function on_post has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def on_post(req, resp, id_):
                        if 'API-KEY' not in req.headers or \
                                not isinstance(req.headers['API-KEY'], str) or \
                                len(str.strip(req.headers['API-KEY'])) == 0:
                            access_control(req)
                Severity: Minor
                Found in myems-api/core/energyflowdiagram.py - About 1 hr to fix

                  Function on_get has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def on_get(req, resp, id_, lid):
                          access_control(req)
                          if not id_.isdigit() or int(id_) <= 0:
                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                     description='API.INVALID_ENERGY_FLOW_DIAGRAM_ID')
                  Severity: Minor
                  Found in myems-api/core/energyflowdiagram.py - About 1 hr to fix

                    Function on_get has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def on_get(req, resp, id_):
                            if 'API-KEY' not in req.headers or \
                                    not isinstance(req.headers['API-KEY'], str) or \
                                    len(str.strip(req.headers['API-KEY'])) == 0:
                                access_control(req)
                    Severity: Minor
                    Found in myems-api/core/energyflowdiagram.py - About 55 mins 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

                    Function on_put has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def on_put(req, resp, id_, nid):
                            """Handles PUT requests"""
                            admin_control(req)
                            if not id_.isdigit() or int(id_) <= 0:
                                raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                    Severity: Minor
                    Found in myems-api/core/energyflowdiagram.py - About 35 mins 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

                    Function on_post has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def on_post(req, resp, id_):
                            """Handles POST requests"""
                            admin_control(req)
                            if not id_.isdigit() or int(id_) <= 0:
                                raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                    Severity: Minor
                    Found in myems-api/core/energyflowdiagram.py - About 25 mins 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

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

                        @staticmethod
                        def on_get(req, resp, id_):
                            if 'API-KEY' not in req.headers or \
                                    not isinstance(req.headers['API-KEY'], str) or \
                                    len(str.strip(req.headers['API-KEY'])) == 0:
                    Severity: Major
                    Found in myems-api/core/energyflowdiagram.py and 1 other location - About 1 wk to fix
                    myems-api/core/energyflowdiagram.py on lines 186..299

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

                    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

                        @staticmethod
                        def on_get(req, resp, id_):
                            if 'API-KEY' not in req.headers or \
                                    not isinstance(req.headers['API-KEY'], str) or \
                                    len(str.strip(req.headers['API-KEY'])) == 0:
                    Severity: Major
                    Found in myems-api/core/energyflowdiagram.py and 1 other location - About 1 wk to fix
                    myems-api/core/energyflowdiagram.py on lines 1242..1355

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

                    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_, lid):
                            admin_control(req)
                            if not id_.isdigit() or int(id_) <= 0:
                    Severity: Major
                    Found in myems-api/core/energyflowdiagram.py and 3 other locations - About 2 days to fix
                    myems-api/core/combinedequipment.py on lines 1238..1284
                    myems-api/core/energyflowdiagram.py on lines 1109..1155
                    myems-api/core/equipment.py on lines 1069..1115

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

                    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_, nid):
                            admin_control(req)
                            if not id_.isdigit() or int(id_) <= 0:
                    Severity: Major
                    Found in myems-api/core/energyflowdiagram.py and 3 other locations - About 2 days to fix
                    myems-api/core/combinedequipment.py on lines 1238..1284
                    myems-api/core/energyflowdiagram.py on lines 748..794
                    myems-api/core/equipment.py on lines 1069..1115

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                            if 'meter_uuid' in new_values['data'].keys():
                                if new_values['data']['meter_uuid'] is not None and \
                                        isinstance(new_values['data']['meter_uuid'], str) and \
                                        len(str.strip(new_values['data']['meter_uuid'])) > 0:
                                    meter_uuid = str.strip(new_values['data']['meter_uuid'])
                    Severity: Major
                    Found in myems-api/core/energyflowdiagram.py and 14 other locations - About 7 hrs to fix
                    myems-api/core/combinedequipment.py on lines 948..952
                    myems-api/core/combinedequipment.py on lines 963..967
                    myems-api/core/combinedequipment.py on lines 970..974
                    myems-api/core/combinedequipment.py on lines 1328..1332
                    myems-api/core/combinedequipment.py on lines 1343..1347
                    myems-api/core/combinedequipment.py on lines 1350..1354
                    myems-api/core/energyflowdiagram.py on lines 535..539
                    myems-api/core/energyflowdiagram.py on lines 1455..1459
                    myems-api/core/equipment.py on lines 791..795
                    myems-api/core/equipment.py on lines 806..810
                    myems-api/core/equipment.py on lines 813..817
                    myems-api/core/equipment.py on lines 1159..1163
                    myems-api/core/equipment.py on lines 1174..1178
                    myems-api/core/equipment.py on lines 1181..1185

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                                if 'uuid' in link['meter'].keys():
                                    if link['meter']['uuid'] is not None and \
                                            isinstance(link['meter']['uuid'], str) and \
                                            len(str.strip(link['meter']['uuid'])) > 0:
                                        meter_uuid = str.strip(link['meter']['uuid'])
                    Severity: Major
                    Found in myems-api/core/energyflowdiagram.py and 14 other locations - About 7 hrs to fix
                    myems-api/core/combinedequipment.py on lines 948..952
                    myems-api/core/combinedequipment.py on lines 963..967
                    myems-api/core/combinedequipment.py on lines 970..974
                    myems-api/core/combinedequipment.py on lines 1328..1332
                    myems-api/core/combinedequipment.py on lines 1343..1347
                    myems-api/core/combinedequipment.py on lines 1350..1354
                    myems-api/core/energyflowdiagram.py on lines 535..539
                    myems-api/core/energyflowdiagram.py on lines 835..839
                    myems-api/core/equipment.py on lines 791..795
                    myems-api/core/equipment.py on lines 806..810
                    myems-api/core/equipment.py on lines 813..817
                    myems-api/core/equipment.py on lines 1159..1163
                    myems-api/core/equipment.py on lines 1174..1178
                    myems-api/core/equipment.py on lines 1181..1185

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                            if 'meter_uuid' in new_values['data'].keys():
                                if new_values['data']['meter_uuid'] is not None and \
                                        isinstance(new_values['data']['meter_uuid'], str) and \
                                        len(str.strip(new_values['data']['meter_uuid'])) > 0:
                                    meter_uuid = str.strip(new_values['data']['meter_uuid'])
                    Severity: Major
                    Found in myems-api/core/energyflowdiagram.py and 14 other locations - About 7 hrs to fix
                    myems-api/core/combinedequipment.py on lines 948..952
                    myems-api/core/combinedequipment.py on lines 963..967
                    myems-api/core/combinedequipment.py on lines 970..974
                    myems-api/core/combinedequipment.py on lines 1328..1332
                    myems-api/core/combinedequipment.py on lines 1343..1347
                    myems-api/core/combinedequipment.py on lines 1350..1354
                    myems-api/core/energyflowdiagram.py on lines 835..839
                    myems-api/core/energyflowdiagram.py on lines 1455..1459
                    myems-api/core/equipment.py on lines 791..795
                    myems-api/core/equipment.py on lines 806..810
                    myems-api/core/equipment.py on lines 813..817
                    myems-api/core/equipment.py on lines 1159..1163
                    myems-api/core/equipment.py on lines 1174..1178
                    myems-api/core/equipment.py on lines 1181..1185

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

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

                            if row is not None:
                                cursor.close()
                                cnx.close()
                                raise falcon.HTTPError(status=falcon.HTTP_400,
                    Severity: Major
                    Found in myems-api/core/energyflowdiagram.py and 40 other locations - About 1 hr to fix
                    myems-api/core/combinedequipment.py on lines 1384..1387
                    myems-api/core/energyflowdiagram.py on lines 559..562
                    myems-api/core/energyflowdiagram.py on lines 1214..1217
                    myems-api/core/energyflowdiagram.py on lines 1476..1479
                    myems-api/core/equipment.py on lines 1215..1218
                    myems-api/core/meter.py on lines 410..413
                    myems-api/core/meter.py on lines 546..549
                    myems-api/core/meter.py on lines 560..563
                    myems-api/core/meter.py on lines 574..577
                    myems-api/core/meter.py on lines 589..592
                    myems-api/core/meter.py on lines 605..608
                    myems-api/core/meter.py on lines 619..622
                    myems-api/core/meter.py on lines 633..636
                    myems-api/core/meter.py on lines 826..829
                    myems-api/core/offlinemeter.py on lines 355..358
                    myems-api/core/point.py on lines 327..330
                    myems-api/core/point.py on lines 341..344
                    myems-api/core/point.py on lines 355..358
                    myems-api/core/point.py on lines 369..372
                    myems-api/core/point.py on lines 383..386
                    myems-api/core/point.py on lines 397..400
                    myems-api/core/point.py on lines 411..414
                    myems-api/core/point.py on lines 425..428
                    myems-api/core/point.py on lines 439..442
                    myems-api/core/point.py on lines 456..459
                    myems-api/core/point.py on lines 472..475
                    myems-api/core/point.py on lines 490..493
                    myems-api/core/point.py on lines 504..507
                    myems-api/core/point.py on lines 518..521
                    myems-api/core/point.py on lines 532..535
                    myems-api/core/point.py on lines 546..549
                    myems-api/core/point.py on lines 560..563
                    myems-api/core/point.py on lines 574..577
                    myems-api/core/point.py on lines 588..591
                    myems-api/core/point.py on lines 603..606
                    myems-api/core/point.py on lines 617..620
                    myems-api/core/point.py on lines 631..634
                    myems-api/core/point.py on lines 649..652
                    myems-api/core/user.py on lines 1102..1105
                    myems-api/core/virtualmeter.py on lines 511..514

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

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

                                if row is not None:
                                    cursor.close()
                                    cnx.close()
                                    raise falcon.HTTPError(status=falcon.HTTP_400,
                    Severity: Major
                    Found in myems-api/core/energyflowdiagram.py and 40 other locations - About 1 hr to fix
                    myems-api/core/combinedequipment.py on lines 1384..1387
                    myems-api/core/energyflowdiagram.py on lines 559..562
                    myems-api/core/energyflowdiagram.py on lines 871..874
                    myems-api/core/energyflowdiagram.py on lines 1214..1217
                    myems-api/core/equipment.py on lines 1215..1218
                    myems-api/core/meter.py on lines 410..413
                    myems-api/core/meter.py on lines 546..549
                    myems-api/core/meter.py on lines 560..563
                    myems-api/core/meter.py on lines 574..577
                    myems-api/core/meter.py on lines 589..592
                    myems-api/core/meter.py on lines 605..608
                    myems-api/core/meter.py on lines 619..622
                    myems-api/core/meter.py on lines 633..636
                    myems-api/core/meter.py on lines 826..829
                    myems-api/core/offlinemeter.py on lines 355..358
                    myems-api/core/point.py on lines 327..330
                    myems-api/core/point.py on lines 341..344
                    myems-api/core/point.py on lines 355..358
                    myems-api/core/point.py on lines 369..372
                    myems-api/core/point.py on lines 383..386
                    myems-api/core/point.py on lines 397..400
                    myems-api/core/point.py on lines 411..414
                    myems-api/core/point.py on lines 425..428
                    myems-api/core/point.py on lines 439..442
                    myems-api/core/point.py on lines 456..459
                    myems-api/core/point.py on lines 472..475
                    myems-api/core/point.py on lines 490..493
                    myems-api/core/point.py on lines 504..507
                    myems-api/core/point.py on lines 518..521
                    myems-api/core/point.py on lines 532..535
                    myems-api/core/point.py on lines 546..549
                    myems-api/core/point.py on lines 560..563
                    myems-api/core/point.py on lines 574..577
                    myems-api/core/point.py on lines 588..591
                    myems-api/core/point.py on lines 603..606
                    myems-api/core/point.py on lines 617..620
                    myems-api/core/point.py on lines 631..634
                    myems-api/core/point.py on lines 649..652
                    myems-api/core/user.py on lines 1102..1105
                    myems-api/core/virtualmeter.py on lines 511..514

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

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

                            if row is not None:
                                cursor.close()
                                cnx.close()
                                raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                    Severity: Major
                    Found in myems-api/core/energyflowdiagram.py and 40 other locations - About 1 hr to fix
                    myems-api/core/combinedequipment.py on lines 1384..1387
                    myems-api/core/energyflowdiagram.py on lines 559..562
                    myems-api/core/energyflowdiagram.py on lines 871..874
                    myems-api/core/energyflowdiagram.py on lines 1476..1479
                    myems-api/core/equipment.py on lines 1215..1218
                    myems-api/core/meter.py on lines 410..413
                    myems-api/core/meter.py on lines 546..549
                    myems-api/core/meter.py on lines 560..563
                    myems-api/core/meter.py on lines 574..577
                    myems-api/core/meter.py on lines 589..592
                    myems-api/core/meter.py on lines 605..608
                    myems-api/core/meter.py on lines 619..622
                    myems-api/core/meter.py on lines 633..636
                    myems-api/core/meter.py on lines 826..829
                    myems-api/core/offlinemeter.py on lines 355..358
                    myems-api/core/point.py on lines 327..330
                    myems-api/core/point.py on lines 341..344
                    myems-api/core/point.py on lines 355..358
                    myems-api/core/point.py on lines 369..372
                    myems-api/core/point.py on lines 383..386
                    myems-api/core/point.py on lines 397..400
                    myems-api/core/point.py on lines 411..414
                    myems-api/core/point.py on lines 425..428
                    myems-api/core/point.py on lines 439..442
                    myems-api/core/point.py on lines 456..459
                    myems-api/core/point.py on lines 472..475
                    myems-api/core/point.py on lines 490..493
                    myems-api/core/point.py on lines 504..507
                    myems-api/core/point.py on lines 518..521
                    myems-api/core/point.py on lines 532..535
                    myems-api/core/point.py on lines 546..549
                    myems-api/core/point.py on lines 560..563
                    myems-api/core/point.py on lines 574..577
                    myems-api/core/point.py on lines 588..591
                    myems-api/core/point.py on lines 603..606
                    myems-api/core/point.py on lines 617..620
                    myems-api/core/point.py on lines 631..634
                    myems-api/core/point.py on lines 649..652
                    myems-api/core/user.py on lines 1102..1105
                    myems-api/core/virtualmeter.py on lines 511..514

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

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

                            if row is not None:
                                cursor.close()
                                cnx.close()
                                raise falcon.HTTPError(status=falcon.HTTP_400,
                    Severity: Major
                    Found in myems-api/core/energyflowdiagram.py and 40 other locations - About 1 hr to fix
                    myems-api/core/combinedequipment.py on lines 1384..1387
                    myems-api/core/energyflowdiagram.py on lines 871..874
                    myems-api/core/energyflowdiagram.py on lines 1214..1217
                    myems-api/core/energyflowdiagram.py on lines 1476..1479
                    myems-api/core/equipment.py on lines 1215..1218
                    myems-api/core/meter.py on lines 410..413
                    myems-api/core/meter.py on lines 546..549
                    myems-api/core/meter.py on lines 560..563
                    myems-api/core/meter.py on lines 574..577
                    myems-api/core/meter.py on lines 589..592
                    myems-api/core/meter.py on lines 605..608
                    myems-api/core/meter.py on lines 619..622
                    myems-api/core/meter.py on lines 633..636
                    myems-api/core/meter.py on lines 826..829
                    myems-api/core/offlinemeter.py on lines 355..358
                    myems-api/core/point.py on lines 327..330
                    myems-api/core/point.py on lines 341..344
                    myems-api/core/point.py on lines 355..358
                    myems-api/core/point.py on lines 369..372
                    myems-api/core/point.py on lines 383..386
                    myems-api/core/point.py on lines 397..400
                    myems-api/core/point.py on lines 411..414
                    myems-api/core/point.py on lines 425..428
                    myems-api/core/point.py on lines 439..442
                    myems-api/core/point.py on lines 456..459
                    myems-api/core/point.py on lines 472..475
                    myems-api/core/point.py on lines 490..493
                    myems-api/core/point.py on lines 504..507
                    myems-api/core/point.py on lines 518..521
                    myems-api/core/point.py on lines 532..535
                    myems-api/core/point.py on lines 546..549
                    myems-api/core/point.py on lines 560..563
                    myems-api/core/point.py on lines 574..577
                    myems-api/core/point.py on lines 588..591
                    myems-api/core/point.py on lines 603..606
                    myems-api/core/point.py on lines 617..620
                    myems-api/core/point.py on lines 631..634
                    myems-api/core/point.py on lines 649..652
                    myems-api/core/user.py on lines 1102..1105
                    myems-api/core/virtualmeter.py on lines 511..514

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

                    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

                    There are no issues that match your filters.

                    Category
                    Status