myems-api/core/equipment.py

Summary

Maintainability
F
6 mos
Test Coverage

File equipment.py has 2680 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/equipment.py - About 1 wk to fix

    Function on_post has a Cognitive Complexity of 271 (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/equipment.py - About 5 days 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 154 (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/equipment.py - About 3 days 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 95 (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/equipment.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_put has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_put(req, resp, id_, pid):
            """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/equipment.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 54 (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/equipment.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 46 (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/equipment.py - About 7 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 39 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_get(req, resp, id_, pid):
            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/equipment.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_post has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_post(req, resp, id_):
            admin_control(req)
            """Handles POST requests"""
            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/equipment.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 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_put(req, resp, id_):
            """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/equipment.py - About 2 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 16 (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/equipment.py - About 2 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 13 (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/equipment.py - About 1 hr 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 12 (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/equipment.py - About 1 hr 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 12 (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/equipment.py - About 1 hr 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 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

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

              def on_put(req, resp, id_):
                  """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/equipment.py - About 1 hr to fix

            Function on_get has a Cognitive Complexity of 11 (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/equipment.py - About 1 hr 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 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def on_get(req, resp, id_, pid):
                    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/equipment.py - About 1 hr to fix

              Function on_post has 31 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/equipment.py - About 1 hr to fix

                Function on_post has 29 lines of code (exceeds 25 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/equipment.py - About 1 hr to fix

                  Function on_get has a Cognitive Complexity of 10 (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/equipment.py - About 1 hr 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 8 (exceeds 5 allowed). Consider refactoring.
                  Open

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

                  Avoid deeply nested control flow statements.
                  Open

                                          if numerator_meter is None:
                                              numerator_meter = virtual_meter_dict.get(row[5], None)
                                          if numerator_meter is None:
                  Severity: Major
                  Found in myems-api/core/equipment.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if denominator_meter is None:
                                                denominator_meter = virtual_meter_dict.get(row[6], None)
                                            if denominator_meter is None:
                    Severity: Major
                    Found in myems-api/core/equipment.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              for row in rows_meters:
                                                  meter_dict[row[2]] = {"type": 'meter',
                                                                        "id": row[0],
                                                                        "name": row[1],
                                                                        "uuid": row[2]}
                      Severity: Major
                      Found in myems-api/core/equipment.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if denominator_meter is None:
                                                    denominator_meter = offline_meter_dict.get(row[6], None)
                        
                        
                        Severity: Major
                        Found in myems-api/core/equipment.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if numerator_meter is None:
                                                      numerator_meter = offline_meter_dict.get(row[5], None)
                                                  # find denominator meter by uuid
                                                  denominator_meter = meter_dict.get(row[6], None)
                          Severity: Major
                          Found in myems-api/core/equipment.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if parameters['constant'] is None:
                                                        raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                               description='API.INVALID_CONSTANT_VALUE')
                            
                            
                            Severity: Major
                            Found in myems-api/core/equipment.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if rows_offline_meters is not None and len(rows_offline_meters) > 0:
                                                          for row in rows_offline_meters:
                                                              offline_meter_dict[row[2]] = {"type": 'offline_meter',
                                                                                            "id": row[0],
                                                                                            "name": row[1],
                              Severity: Major
                              Found in myems-api/core/equipment.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        if rows_meters is not None and len(rows_meters) > 0:
                                                            for row in rows_meters:
                                                                meter_dict[row[2]] = {"type": 'meter',
                                                                                      "id": row[0],
                                                                                      "name": row[1],
                                Severity: Major
                                Found in myems-api/core/equipment.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if point_id is None:
                                                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                                     description='API.INVALID_POINT_ID')
                                                          query = (" SELECT id, name "
                                  Severity: Major
                                  Found in myems-api/core/equipment.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            if parameters['numerator_meter'] is not None and \
                                                                    isinstance(parameters['numerator_meter']['uuid'], str) and \
                                                                    len(str.strip(parameters['numerator_meter']['uuid'])) > 0:
                                                                numerator_meter_uuid = str.strip(parameters['numerator_meter']['uuid'])
                                    
                                    
                                    Severity: Major
                                    Found in myems-api/core/equipment.py - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                              for row in rows_offline_meters:
                                                                  offline_meter_dict[row[2]] = {"type": 'offline_meter',
                                                                                                "id": row[0],
                                                                                                "name": row[1],
                                                                                                "uuid": row[2]}
                                      Severity: Major
                                      Found in myems-api/core/equipment.py - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                                if numerator_meter is None:
                                                                    numerator_meter = virtual_meter_dict.get(row[5], None)
                                                                if numerator_meter is None:
                                        Severity: Major
                                        Found in myems-api/core/equipment.py - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                                  if cursor.fetchone() is None:
                                                                      cursor.close()
                                                                      cnx.close()
                                                                      raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                                             description='API.POINT_NOT_FOUND')
                                          Severity: Major
                                          Found in myems-api/core/equipment.py - About 45 mins to fix

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

                                                def on_post(req, resp, id_):
                                                    """Handles POST requests"""
                                                    admin_control(req)
                                                    try:
                                                        raw_json = req.stream.read().decode('utf-8')
                                            Severity: Minor
                                            Found in myems-api/core/equipment.py - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
                                            Open

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

                                            Avoid deeply nested control flow statements.
                                            Open

                                                                    if rows_virtual_meters is not None and len(rows_virtual_meters) > 0:
                                                                        for row in rows_virtual_meters:
                                                                            virtual_meter_dict[row[2]] = {"type": 'virtual_meter',
                                                                                                          "id": row[0],
                                                                                                          "name": row[1],
                                            Severity: Major
                                            Found in myems-api/core/equipment.py - About 45 mins to fix

                                              Function on_get has a Cognitive Complexity of 8 (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/equipment.py - About 45 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

                                              Avoid deeply nested control flow statements.
                                              Open

                                                                      if numerator_meter is None:
                                                                          numerator_meter = offline_meter_dict.get(row[5], None)
                                                                      # find denominator meter by uuid
                                                                      denominator_meter = meter_dict.get(row[6], None)
                                              Severity: Major
                                              Found in myems-api/core/equipment.py - About 45 mins to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                                        if denominator_meter is None:
                                                                            denominator_meter = offline_meter_dict.get(row[6], None)
                                                
                                                
                                                Severity: Major
                                                Found in myems-api/core/equipment.py - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                                          if parameters['denominator_meter'] is not None and \
                                                                                  isinstance(parameters['denominator_meter']['uuid'], str) and \
                                                                                  len(str.strip(parameters['denominator_meter']['uuid'])) > 0:
                                                                              denominator_meter_uuid = str.strip(parameters['denominator_meter']['uuid'])
                                                  
                                                  
                                                  Severity: Major
                                                  Found in myems-api/core/equipment.py - About 45 mins to fix

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                                            if numerator_meter_uuid is None:
                                                                                raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                                                       description='API.INVALID_NUMERATOR_METER_UUID')
                                                    
                                                    
                                                    Severity: Major
                                                    Found in myems-api/core/equipment.py - About 45 mins to fix

                                                      Avoid deeply nested control flow statements.
                                                      Open

                                                                              if parameters['point'] is None:
                                                                                  point_id = None
                                                                              elif parameters['point']['id'] is not None and \
                                                                                      parameters['point']['id'] <= 0:
                                                                                  raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                      Severity: Major
                                                      Found in myems-api/core/equipment.py - About 45 mins to fix

                                                        Avoid deeply nested control flow statements.
                                                        Open

                                                                                for row in rows_virtual_meters:
                                                                                    virtual_meter_dict[row[2]] = {"type": 'virtual_meter',
                                                                                                                  "id": row[0],
                                                                                                                  "name": row[1],
                                                                                                                  "uuid": row[2]}
                                                        Severity: Major
                                                        Found in myems-api/core/equipment.py - About 45 mins to fix

                                                          Avoid deeply nested control flow statements.
                                                          Open

                                                                                  if denominator_meter is None:
                                                                                      denominator_meter = virtual_meter_dict.get(row[6], None)
                                                                                  if denominator_meter is None:
                                                          Severity: Major
                                                          Found in myems-api/core/equipment.py - About 45 mins to fix

                                                            Avoid deeply nested control flow statements.
                                                            Open

                                                                                    if denominator_meter_uuid not in meter_dict and \
                                                                                            denominator_meter_uuid not in virtual_meter_dict and \
                                                                                            denominator_meter_uuid not in offline_meter_dict:
                                                                                        raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                                                               description='API.INVALID_DENOMINATOR_METER_UUID')
                                                            Severity: Major
                                                            Found in myems-api/core/equipment.py - About 45 mins to fix

                                                              Avoid deeply nested control flow statements.
                                                              Open

                                                                                      if meter_dict.get(numerator_meter_uuid) is None and \
                                                                                              virtual_meter_dict.get(numerator_meter_uuid) is None and \
                                                                                              offline_meter_dict.get(numerator_meter_uuid) is None:
                                                                                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                                                                 description='API.INVALID_NUMERATOR_METER_UUID')
                                                              Severity: Major
                                                              Found in myems-api/core/equipment.py - About 45 mins to fix

                                                                Avoid deeply nested control flow statements.
                                                                Open

                                                                                        if denominator_meter_uuid == numerator_meter_uuid:
                                                                                            raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                                                                   description='API.INVALID_DENOMINATOR_METER_UUID')
                                                                
                                                                
                                                                Severity: Major
                                                                Found in myems-api/core/equipment.py - About 45 mins to fix

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

                                                                      def on_post(req, resp, id_):
                                                                          """Handles POST requests"""
                                                                          admin_control(req)
                                                                          try:
                                                                              raw_json = req.stream.read().decode('utf-8')
                                                                  Severity: Minor
                                                                  Found in myems-api/core/equipment.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_delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                  Open

                                                                      def on_delete(req, resp, id_, cid):
                                                                          admin_control(req)
                                                                          if not id_.isdigit() or int(id_) <= 0:
                                                                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                                                     description='API.INVALID_EQUIPMENT_ID')
                                                                  Severity: Minor
                                                                  Found in myems-api/core/equipment.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

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

                                                                      def on_delete(req, resp, id_, mid):
                                                                          admin_control(req)
                                                                          if not id_.isdigit() or int(id_) <= 0:
                                                                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                                                     description='API.INVALID_EQUIPMENT_ID')
                                                                  Severity: Minor
                                                                  Found in myems-api/core/equipment.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

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

                                                                      def on_delete(req, resp, id_, mid):
                                                                          admin_control(req)
                                                                          if not id_.isdigit() or int(id_) <= 0:
                                                                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                                                     description='API.INVALID_EQUIPMENT_ID')
                                                                  Severity: Minor
                                                                  Found in myems-api/core/equipment.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

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

                                                                      def on_delete(req, resp, id_, mid):
                                                                          admin_control(req)
                                                                          if not id_.isdigit() or int(id_) <= 0:
                                                                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                                                     description='API.INVALID_EQUIPMENT_ID')
                                                                  Severity: Minor
                                                                  Found in myems-api/core/equipment.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

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

                                                                      def on_delete(req, resp, id_):
                                                                          admin_control(req)
                                                                          if not id_.isdigit() or int(id_) <= 0:
                                                                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                                                     description='API.INVALID_EQUIPMENT_ID')
                                                                  Severity: Minor
                                                                  Found in myems-api/core/equipment.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

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

                                                                  class EquipmentCollection:
                                                                      @staticmethod
                                                                      def __init__():
                                                                          """Initializes EquipmentCollection"""
                                                                          pass
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 1 other location - About 2 wks to fix
                                                                  myems-api/core/combinedequipment.py on lines 10..173

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

                                                                  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

                                                                      @staticmethod
                                                                      @user_logger
                                                                      def on_put(req, resp, id_):
                                                                          """Handles PUT requests"""
                                                                          admin_control(req)
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 1 other location - About 1 wk to fix
                                                                  myems-api/core/combinedequipment.py on lines 291..404

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

                                                                  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

                                                                  class EquipmentMeterCollection:
                                                                      @staticmethod
                                                                      def __init__():
                                                                          """Initializes EquipmentMeterCollection"""
                                                                          pass
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 2 other locations - About 1 wk to fix
                                                                  myems-api/core/equipment.py on lines 1476..1611
                                                                  myems-api/core/equipment.py on lines 1676..1811

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

                                                                  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

                                                                  class EquipmentVirtualMeterCollection:
                                                                      @staticmethod
                                                                      def __init__():
                                                                          """Initializes EquipmentVirtualMeterCollection"""
                                                                          pass
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 2 other locations - About 1 wk to fix
                                                                  myems-api/core/equipment.py on lines 1277..1412
                                                                  myems-api/core/equipment.py on lines 1476..1611

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

                                                                  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

                                                                  class EquipmentOfflineMeterCollection:
                                                                      @staticmethod
                                                                      def __init__():
                                                                          """Initializes EquipmentOfflineMeterCollection"""
                                                                          pass
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 2 other locations - About 1 wk to fix
                                                                  myems-api/core/equipment.py on lines 1277..1412
                                                                  myems-api/core/equipment.py on lines 1676..1811

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

                                                                  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

                                                                      @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/equipment.py and 1 other location - About 1 wk to fix
                                                                  myems-api/core/combinedequipment.py on lines 743..869

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

                                                                  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

                                                                      @staticmethod
                                                                      def on_get(req, resp, id_, pid):
                                                                          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/equipment.py and 1 other location - About 1 wk to fix
                                                                  myems-api/core/combinedequipment.py on lines 1077..1197

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

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

                                                                  class EquipmentCommandCollection:
                                                                      @staticmethod
                                                                      def __init__():
                                                                          """Initializes Class"""
                                                                          pass
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 22 other locations - About 1 wk to fix
                                                                  myems-api/core/combinedequipment.py on lines 2065..2178
                                                                  myems-api/core/meter.py on lines 1147..1260
                                                                  myems-api/core/shopfloor.py on lines 460..573
                                                                  myems-api/core/shopfloor.py on lines 1209..1322
                                                                  myems-api/core/shopfloor.py on lines 1577..1690
                                                                  myems-api/core/shopfloor.py on lines 1755..1868
                                                                  myems-api/core/space.py on lines 820..933
                                                                  myems-api/core/space.py on lines 998..1111
                                                                  myems-api/core/space.py on lines 1176..1289
                                                                  myems-api/core/space.py on lines 1926..2039
                                                                  myems-api/core/space.py on lines 2103..2216
                                                                  myems-api/core/space.py on lines 2280..2393
                                                                  myems-api/core/space.py on lines 2457..2570
                                                                  myems-api/core/space.py on lines 3012..3125
                                                                  myems-api/core/space.py on lines 3190..3303
                                                                  myems-api/core/store.py on lines 1150..1263
                                                                  myems-api/core/store.py on lines 1518..1631
                                                                  myems-api/core/store.py on lines 1696..1809
                                                                  myems-api/core/tenant.py on lines 1249..1364
                                                                  myems-api/core/tenant.py on lines 1621..1736
                                                                  myems-api/core/tenant.py on lines 1801..1916
                                                                  myems-api/core/virtualpowerplant.py on lines 393..506

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

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                          if parameter_type == 'point':
                                                                              if point_id is None:
                                                                                  raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                                                         description='API.INVALID_POINT_ID')
                                                                              query = (" SELECT id, name "
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 1 other location - About 5 days to fix
                                                                  myems-api/core/equipment.py on lines 1178..1255

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

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                          if parameter_type == 'point':
                                                                              if point_id is None:
                                                                                  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 1 other location - About 5 days to fix
                                                                  myems-api/core/equipment.py on lines 796..869

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

                                                                  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

                                                                      @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/equipment.py and 1 other location - About 4 days to fix
                                                                  myems-api/core/combinedequipment.py on lines 186..238

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

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

                                                                  class EquipmentMeterItem:
                                                                      @staticmethod
                                                                      def __init__():
                                                                          """Initializes EquipmentMeterItem"""
                                                                          pass
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 49 other locations - About 3 days to fix
                                                                  myems-api/core/combinedequipment.py on lines 671..730
                                                                  myems-api/core/combinedequipment.py on lines 1600..1659
                                                                  myems-api/core/combinedequipment.py on lines 1802..1861
                                                                  myems-api/core/combinedequipment.py on lines 2003..2062
                                                                  myems-api/core/combinedequipment.py on lines 2181..2240
                                                                  myems-api/core/distributioncircuit.py on lines 530..589
                                                                  myems-api/core/energystoragecontainer.py on lines 555..614
                                                                  myems-api/core/energystoragepowerstation.py on lines 661..720
                                                                  myems-api/core/equipment.py on lines 1614..1673
                                                                  myems-api/core/equipment.py on lines 1814..1873
                                                                  myems-api/core/equipment.py on lines 1994..2052
                                                                  myems-api/core/meter.py on lines 1263..1321
                                                                  myems-api/core/microgrid.py on lines 5112..5171
                                                                  myems-api/core/sensor.py on lines 420..478
                                                                  myems-api/core/shopfloor.py on lines 576..635
                                                                  myems-api/core/shopfloor.py on lines 767..825
                                                                  myems-api/core/shopfloor.py on lines 957..1016
                                                                  myems-api/core/shopfloor.py on lines 1147..1206
                                                                  myems-api/core/shopfloor.py on lines 1325..1383
                                                                  myems-api/core/shopfloor.py on lines 1515..1574
                                                                  myems-api/core/shopfloor.py on lines 1693..1752
                                                                  myems-api/core/shopfloor.py on lines 1871..1929
                                                                  myems-api/core/space.py on lines 936..995
                                                                  myems-api/core/space.py on lines 1114..1173
                                                                  myems-api/core/space.py on lines 1292..1350
                                                                  myems-api/core/space.py on lines 1674..1733
                                                                  myems-api/core/space.py on lines 1864..1923
                                                                  myems-api/core/space.py on lines 2042..2100
                                                                  myems-api/core/space.py on lines 2219..2277
                                                                  myems-api/core/space.py on lines 2396..2454
                                                                  myems-api/core/space.py on lines 2573..2631
                                                                  myems-api/core/space.py on lines 2763..2822
                                                                  myems-api/core/space.py on lines 3128..3187
                                                                  myems-api/core/space.py on lines 3306..3364
                                                                  myems-api/core/store.py on lines 708..766
                                                                  myems-api/core/store.py on lines 898..957
                                                                  myems-api/core/store.py on lines 1088..1147
                                                                  myems-api/core/store.py on lines 1266..1324
                                                                  myems-api/core/store.py on lines 1456..1515
                                                                  myems-api/core/store.py on lines 1634..1693
                                                                  myems-api/core/store.py on lines 1812..1870
                                                                  myems-api/core/tenant.py on lines 803..861
                                                                  myems-api/core/tenant.py on lines 995..1054
                                                                  myems-api/core/tenant.py on lines 1187..1246
                                                                  myems-api/core/tenant.py on lines 1367..1425
                                                                  myems-api/core/tenant.py on lines 1559..1618
                                                                  myems-api/core/tenant.py on lines 1739..1798
                                                                  myems-api/core/tenant.py on lines 1919..1977
                                                                  myems-api/core/virtualpowerplant.py on lines 509..568

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

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

                                                                  class EquipmentOfflineMeterItem:
                                                                      @staticmethod
                                                                      def __init__():
                                                                          """Initializes EquipmentOfflineMeterItem"""
                                                                          pass
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 49 other locations - About 3 days to fix
                                                                  myems-api/core/combinedequipment.py on lines 671..730
                                                                  myems-api/core/combinedequipment.py on lines 1600..1659
                                                                  myems-api/core/combinedequipment.py on lines 1802..1861
                                                                  myems-api/core/combinedequipment.py on lines 2003..2062
                                                                  myems-api/core/combinedequipment.py on lines 2181..2240
                                                                  myems-api/core/distributioncircuit.py on lines 530..589
                                                                  myems-api/core/energystoragecontainer.py on lines 555..614
                                                                  myems-api/core/energystoragepowerstation.py on lines 661..720
                                                                  myems-api/core/equipment.py on lines 1415..1473
                                                                  myems-api/core/equipment.py on lines 1814..1873
                                                                  myems-api/core/equipment.py on lines 1994..2052
                                                                  myems-api/core/meter.py on lines 1263..1321
                                                                  myems-api/core/microgrid.py on lines 5112..5171
                                                                  myems-api/core/sensor.py on lines 420..478
                                                                  myems-api/core/shopfloor.py on lines 576..635
                                                                  myems-api/core/shopfloor.py on lines 767..825
                                                                  myems-api/core/shopfloor.py on lines 957..1016
                                                                  myems-api/core/shopfloor.py on lines 1147..1206
                                                                  myems-api/core/shopfloor.py on lines 1325..1383
                                                                  myems-api/core/shopfloor.py on lines 1515..1574
                                                                  myems-api/core/shopfloor.py on lines 1693..1752
                                                                  myems-api/core/shopfloor.py on lines 1871..1929
                                                                  myems-api/core/space.py on lines 936..995
                                                                  myems-api/core/space.py on lines 1114..1173
                                                                  myems-api/core/space.py on lines 1292..1350
                                                                  myems-api/core/space.py on lines 1674..1733
                                                                  myems-api/core/space.py on lines 1864..1923
                                                                  myems-api/core/space.py on lines 2042..2100
                                                                  myems-api/core/space.py on lines 2219..2277
                                                                  myems-api/core/space.py on lines 2396..2454
                                                                  myems-api/core/space.py on lines 2573..2631
                                                                  myems-api/core/space.py on lines 2763..2822
                                                                  myems-api/core/space.py on lines 3128..3187
                                                                  myems-api/core/space.py on lines 3306..3364
                                                                  myems-api/core/store.py on lines 708..766
                                                                  myems-api/core/store.py on lines 898..957
                                                                  myems-api/core/store.py on lines 1088..1147
                                                                  myems-api/core/store.py on lines 1266..1324
                                                                  myems-api/core/store.py on lines 1456..1515
                                                                  myems-api/core/store.py on lines 1634..1693
                                                                  myems-api/core/store.py on lines 1812..1870
                                                                  myems-api/core/tenant.py on lines 803..861
                                                                  myems-api/core/tenant.py on lines 995..1054
                                                                  myems-api/core/tenant.py on lines 1187..1246
                                                                  myems-api/core/tenant.py on lines 1367..1425
                                                                  myems-api/core/tenant.py on lines 1559..1618
                                                                  myems-api/core/tenant.py on lines 1739..1798
                                                                  myems-api/core/tenant.py on lines 1919..1977
                                                                  myems-api/core/virtualpowerplant.py on lines 509..568

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

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

                                                                  class EquipmentVirtualMeterItem:
                                                                      @staticmethod
                                                                      def __init__():
                                                                          """Initializes EquipmentVirtualMeterItem"""
                                                                          pass
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 49 other locations - About 3 days to fix
                                                                  myems-api/core/combinedequipment.py on lines 671..730
                                                                  myems-api/core/combinedequipment.py on lines 1600..1659
                                                                  myems-api/core/combinedequipment.py on lines 1802..1861
                                                                  myems-api/core/combinedequipment.py on lines 2003..2062
                                                                  myems-api/core/combinedequipment.py on lines 2181..2240
                                                                  myems-api/core/distributioncircuit.py on lines 530..589
                                                                  myems-api/core/energystoragecontainer.py on lines 555..614
                                                                  myems-api/core/energystoragepowerstation.py on lines 661..720
                                                                  myems-api/core/equipment.py on lines 1415..1473
                                                                  myems-api/core/equipment.py on lines 1614..1673
                                                                  myems-api/core/equipment.py on lines 1994..2052
                                                                  myems-api/core/meter.py on lines 1263..1321
                                                                  myems-api/core/microgrid.py on lines 5112..5171
                                                                  myems-api/core/sensor.py on lines 420..478
                                                                  myems-api/core/shopfloor.py on lines 576..635
                                                                  myems-api/core/shopfloor.py on lines 767..825
                                                                  myems-api/core/shopfloor.py on lines 957..1016
                                                                  myems-api/core/shopfloor.py on lines 1147..1206
                                                                  myems-api/core/shopfloor.py on lines 1325..1383
                                                                  myems-api/core/shopfloor.py on lines 1515..1574
                                                                  myems-api/core/shopfloor.py on lines 1693..1752
                                                                  myems-api/core/shopfloor.py on lines 1871..1929
                                                                  myems-api/core/space.py on lines 936..995
                                                                  myems-api/core/space.py on lines 1114..1173
                                                                  myems-api/core/space.py on lines 1292..1350
                                                                  myems-api/core/space.py on lines 1674..1733
                                                                  myems-api/core/space.py on lines 1864..1923
                                                                  myems-api/core/space.py on lines 2042..2100
                                                                  myems-api/core/space.py on lines 2219..2277
                                                                  myems-api/core/space.py on lines 2396..2454
                                                                  myems-api/core/space.py on lines 2573..2631
                                                                  myems-api/core/space.py on lines 2763..2822
                                                                  myems-api/core/space.py on lines 3128..3187
                                                                  myems-api/core/space.py on lines 3306..3364
                                                                  myems-api/core/store.py on lines 708..766
                                                                  myems-api/core/store.py on lines 898..957
                                                                  myems-api/core/store.py on lines 1088..1147
                                                                  myems-api/core/store.py on lines 1266..1324
                                                                  myems-api/core/store.py on lines 1456..1515
                                                                  myems-api/core/store.py on lines 1634..1693
                                                                  myems-api/core/store.py on lines 1812..1870
                                                                  myems-api/core/tenant.py on lines 803..861
                                                                  myems-api/core/tenant.py on lines 995..1054
                                                                  myems-api/core/tenant.py on lines 1187..1246
                                                                  myems-api/core/tenant.py on lines 1367..1425
                                                                  myems-api/core/tenant.py on lines 1559..1618
                                                                  myems-api/core/tenant.py on lines 1739..1798
                                                                  myems-api/core/tenant.py on lines 1919..1977
                                                                  myems-api/core/virtualpowerplant.py on lines 509..568

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

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

                                                                  class EquipmentCommandItem:
                                                                      @staticmethod
                                                                      def __init__():
                                                                          """Initializes Class"""
                                                                          pass
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 49 other locations - About 3 days to fix
                                                                  myems-api/core/combinedequipment.py on lines 671..730
                                                                  myems-api/core/combinedequipment.py on lines 1600..1659
                                                                  myems-api/core/combinedequipment.py on lines 1802..1861
                                                                  myems-api/core/combinedequipment.py on lines 2003..2062
                                                                  myems-api/core/combinedequipment.py on lines 2181..2240
                                                                  myems-api/core/distributioncircuit.py on lines 530..589
                                                                  myems-api/core/energystoragecontainer.py on lines 555..614
                                                                  myems-api/core/energystoragepowerstation.py on lines 661..720
                                                                  myems-api/core/equipment.py on lines 1415..1473
                                                                  myems-api/core/equipment.py on lines 1614..1673
                                                                  myems-api/core/equipment.py on lines 1814..1873
                                                                  myems-api/core/meter.py on lines 1263..1321
                                                                  myems-api/core/microgrid.py on lines 5112..5171
                                                                  myems-api/core/sensor.py on lines 420..478
                                                                  myems-api/core/shopfloor.py on lines 576..635
                                                                  myems-api/core/shopfloor.py on lines 767..825
                                                                  myems-api/core/shopfloor.py on lines 957..1016
                                                                  myems-api/core/shopfloor.py on lines 1147..1206
                                                                  myems-api/core/shopfloor.py on lines 1325..1383
                                                                  myems-api/core/shopfloor.py on lines 1515..1574
                                                                  myems-api/core/shopfloor.py on lines 1693..1752
                                                                  myems-api/core/shopfloor.py on lines 1871..1929
                                                                  myems-api/core/space.py on lines 936..995
                                                                  myems-api/core/space.py on lines 1114..1173
                                                                  myems-api/core/space.py on lines 1292..1350
                                                                  myems-api/core/space.py on lines 1674..1733
                                                                  myems-api/core/space.py on lines 1864..1923
                                                                  myems-api/core/space.py on lines 2042..2100
                                                                  myems-api/core/space.py on lines 2219..2277
                                                                  myems-api/core/space.py on lines 2396..2454
                                                                  myems-api/core/space.py on lines 2573..2631
                                                                  myems-api/core/space.py on lines 2763..2822
                                                                  myems-api/core/space.py on lines 3128..3187
                                                                  myems-api/core/space.py on lines 3306..3364
                                                                  myems-api/core/store.py on lines 708..766
                                                                  myems-api/core/store.py on lines 898..957
                                                                  myems-api/core/store.py on lines 1088..1147
                                                                  myems-api/core/store.py on lines 1266..1324
                                                                  myems-api/core/store.py on lines 1456..1515
                                                                  myems-api/core/store.py on lines 1634..1693
                                                                  myems-api/core/store.py on lines 1812..1870
                                                                  myems-api/core/tenant.py on lines 803..861
                                                                  myems-api/core/tenant.py on lines 995..1054
                                                                  myems-api/core/tenant.py on lines 1187..1246
                                                                  myems-api/core/tenant.py on lines 1367..1425
                                                                  myems-api/core/tenant.py on lines 1559..1618
                                                                  myems-api/core/tenant.py on lines 1739..1798
                                                                  myems-api/core/tenant.py on lines 1919..1977
                                                                  myems-api/core/virtualpowerplant.py on lines 509..568

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

                                                                  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

                                                                              if rows_parameters is not None and len(rows_parameters) > 0:
                                                                                  for row in rows_parameters:
                                                                                      constant = None
                                                                                      point = None
                                                                                      numerator_meter = None
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 3 other locations - About 3 days to fix
                                                                  myems-api/core/combinedequipment.py on lines 2478..2518
                                                                  myems-api/core/combinedequipment.py on lines 3141..3181
                                                                  myems-api/core/equipment.py on lines 2257..2297

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

                                                                  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

                                                                              if rows_parameters is not None and len(rows_parameters) > 0:
                                                                                  for row in rows_parameters:
                                                                                      constant = None
                                                                                      point = None
                                                                                      numerator_meter = None
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 3 other locations - About 3 days to fix
                                                                  myems-api/core/combinedequipment.py on lines 2478..2518
                                                                  myems-api/core/combinedequipment.py on lines 3141..3181
                                                                  myems-api/core/equipment.py on lines 2849..2889

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

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                          if rows_parameters is not None and len(rows_parameters) > 0:
                                                                              add_values = (" INSERT INTO tbl_equipments_parameters"
                                                                                            "     (equipment_id, name, parameter_type, constant, point_id, "
                                                                                            "      numerator_meter_uuid, denominator_meter_uuid) "
                                                                                            " VALUES  ")
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 1 other location - About 3 days to fix
                                                                  myems-api/core/combinedequipment.py on lines 515..545

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

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

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

                                                                          if new_values['offline_meters'] is not None and len(new_values['offline_meters']) > 0:
                                                                              for offline_meter in new_values['offline_meters']:
                                                                                  cursor.execute(" SELECT name "
                                                                                                 " FROM tbl_offline_meters "
                                                                                                 " WHERE id = %s ", (offline_meter['id'],))
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 11 other locations - About 1 day to fix
                                                                  myems-api/core/combinedequipment.py on lines 2681..2704
                                                                  myems-api/core/combinedequipment.py on lines 2705..2729
                                                                  myems-api/core/combinedequipment.py on lines 2730..2754
                                                                  myems-api/core/combinedequipment.py on lines 3249..3273
                                                                  myems-api/core/combinedequipment.py on lines 3274..3298
                                                                  myems-api/core/combinedequipment.py on lines 3299..3323
                                                                  myems-api/core/equipment.py on lines 2435..2458
                                                                  myems-api/core/equipment.py on lines 2483..2506
                                                                  myems-api/core/equipment.py on lines 2933..2956
                                                                  myems-api/core/equipment.py on lines 2957..2981
                                                                  myems-api/core/equipment.py on lines 2982..3006

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

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                              if meta_result['meters'] is not None and len(meta_result['meters']) > 0:
                                                                                  for meter in meta_result['meters']:
                                                                                      cursor.execute(" SELECT name "
                                                                                                     " FROM tbl_meters "
                                                                                                     " WHERE id = %s ", (meter['id'],))
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 11 other locations - About 1 day to fix
                                                                  myems-api/core/combinedequipment.py on lines 2681..2704
                                                                  myems-api/core/combinedequipment.py on lines 2705..2729
                                                                  myems-api/core/combinedequipment.py on lines 2730..2754
                                                                  myems-api/core/combinedequipment.py on lines 3249..3273
                                                                  myems-api/core/combinedequipment.py on lines 3274..3298
                                                                  myems-api/core/combinedequipment.py on lines 3299..3323
                                                                  myems-api/core/equipment.py on lines 2435..2458
                                                                  myems-api/core/equipment.py on lines 2459..2482
                                                                  myems-api/core/equipment.py on lines 2483..2506
                                                                  myems-api/core/equipment.py on lines 2957..2981
                                                                  myems-api/core/equipment.py on lines 2982..3006

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

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                          if new_values['virtual_meters'] is not None and len(new_values['virtual_meters']) > 0:
                                                                              for virtual_meter in new_values['virtual_meters']:
                                                                                  cursor.execute(" SELECT name "
                                                                                                 " FROM tbl_virtual_meters "
                                                                                                 " WHERE id = %s ", (virtual_meter['id'],))
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 11 other locations - About 1 day to fix
                                                                  myems-api/core/combinedequipment.py on lines 2681..2704
                                                                  myems-api/core/combinedequipment.py on lines 2705..2729
                                                                  myems-api/core/combinedequipment.py on lines 2730..2754
                                                                  myems-api/core/combinedequipment.py on lines 3249..3273
                                                                  myems-api/core/combinedequipment.py on lines 3274..3298
                                                                  myems-api/core/combinedequipment.py on lines 3299..3323
                                                                  myems-api/core/equipment.py on lines 2435..2458
                                                                  myems-api/core/equipment.py on lines 2459..2482
                                                                  myems-api/core/equipment.py on lines 2933..2956
                                                                  myems-api/core/equipment.py on lines 2957..2981
                                                                  myems-api/core/equipment.py on lines 2982..3006

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

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                              if meta_result['virtual_meters'] is not None and len(meta_result['virtual_meters']) > 0:
                                                                                  for virtual_meter in meta_result['virtual_meters']:
                                                                                      cursor.execute(" SELECT name "
                                                                                                     " FROM tbl_virtual_meters "
                                                                                                     " WHERE id = %s ", (virtual_meter['id'],))
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 11 other locations - About 1 day to fix
                                                                  myems-api/core/combinedequipment.py on lines 2681..2704
                                                                  myems-api/core/combinedequipment.py on lines 2705..2729
                                                                  myems-api/core/combinedequipment.py on lines 2730..2754
                                                                  myems-api/core/combinedequipment.py on lines 3249..3273
                                                                  myems-api/core/combinedequipment.py on lines 3274..3298
                                                                  myems-api/core/combinedequipment.py on lines 3299..3323
                                                                  myems-api/core/equipment.py on lines 2435..2458
                                                                  myems-api/core/equipment.py on lines 2459..2482
                                                                  myems-api/core/equipment.py on lines 2483..2506
                                                                  myems-api/core/equipment.py on lines 2933..2956
                                                                  myems-api/core/equipment.py on lines 2957..2981

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

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                          if new_values['meters'] is not None and len(new_values['meters']) > 0:
                                                                              for meter in new_values['meters']:
                                                                                  cursor.execute(" SELECT name "
                                                                                                 " FROM tbl_meters "
                                                                                                 " WHERE id = %s ", (meter['id'],))
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 11 other locations - About 1 day to fix
                                                                  myems-api/core/combinedequipment.py on lines 2681..2704
                                                                  myems-api/core/combinedequipment.py on lines 2705..2729
                                                                  myems-api/core/combinedequipment.py on lines 2730..2754
                                                                  myems-api/core/combinedequipment.py on lines 3249..3273
                                                                  myems-api/core/combinedequipment.py on lines 3274..3298
                                                                  myems-api/core/combinedequipment.py on lines 3299..3323
                                                                  myems-api/core/equipment.py on lines 2459..2482
                                                                  myems-api/core/equipment.py on lines 2483..2506
                                                                  myems-api/core/equipment.py on lines 2933..2956
                                                                  myems-api/core/equipment.py on lines 2957..2981
                                                                  myems-api/core/equipment.py on lines 2982..3006

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

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                              if meta_result['offline_meters'] is not None and len(meta_result['offline_meters']) > 0:
                                                                                  for offline_meter in meta_result['offline_meters']:
                                                                                      cursor.execute(" SELECT name "
                                                                                                     " FROM tbl_offline_meters "
                                                                                                     " WHERE id = %s ", (offline_meter['id'],))
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 11 other locations - About 1 day to fix
                                                                  myems-api/core/combinedequipment.py on lines 2681..2704
                                                                  myems-api/core/combinedequipment.py on lines 2705..2729
                                                                  myems-api/core/combinedequipment.py on lines 2730..2754
                                                                  myems-api/core/combinedequipment.py on lines 3249..3273
                                                                  myems-api/core/combinedequipment.py on lines 3274..3298
                                                                  myems-api/core/combinedequipment.py on lines 3299..3323
                                                                  myems-api/core/equipment.py on lines 2435..2458
                                                                  myems-api/core/equipment.py on lines 2459..2482
                                                                  myems-api/core/equipment.py on lines 2483..2506
                                                                  myems-api/core/equipment.py on lines 2933..2956
                                                                  myems-api/core/equipment.py on lines 2982..3006

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

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                          if rows_offline_meters is not None and len(rows_offline_meters) > 0:
                                                                              add_values = (" INSERT INTO tbl_equipments_offline_meters (equipment_id, offline_meter_id, is_output) "
                                                                                            " VALUES  ")
                                                                              for row in rows_offline_meters:
                                                                                  add_values += " (" + str(new_id) + ","
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 1 other location - About 1 day to fix
                                                                  myems-api/core/combinedequipment.py on lines 479..489

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

                                                                  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

                                                                          if rows_meters is not None and len(rows_meters) > 0:
                                                                              add_values = (" INSERT INTO tbl_equipments_meters (equipment_id, meter_id, is_output) "
                                                                                            " VALUES  ")
                                                                              for row in rows_meters:
                                                                                  add_values += " (" + str(new_id) + ","
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 3 other locations - About 1 day to fix
                                                                  myems-api/core/combinedequipment.py on lines 462..471
                                                                  myems-api/core/combinedequipment.py on lines 497..507
                                                                  myems-api/core/equipment.py on lines 517..526

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

                                                                  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

                                                                          if rows_virtual_meters is not None and len(rows_virtual_meters) > 0:
                                                                              add_values = (" INSERT INTO tbl_equipments_virtual_meters (equipment_id, virtual_meter_id, is_output) "
                                                                                            " VALUES  ")
                                                                              for row in rows_virtual_meters:
                                                                                  add_values += " (" + str(new_id) + ","
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 3 other locations - About 1 day to fix
                                                                  myems-api/core/combinedequipment.py on lines 462..471
                                                                  myems-api/core/combinedequipment.py on lines 497..507
                                                                  myems-api/core/equipment.py on lines 483..492

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

                                                                  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 'numerator_meter_uuid' in new_values['data'].keys():
                                                                              if new_values['data']['numerator_meter_uuid'] is not None and \
                                                                                      isinstance(new_values['data']['numerator_meter_uuid'], str) and \
                                                                                      len(str.strip(new_values['data']['numerator_meter_uuid'])) > 0:
                                                                                  numerator_meter_uuid = str.strip(new_values['data']['numerator_meter_uuid'])
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 14 other locations - About 7 hrs to fix
                                                                  myems-api/core/combinedequipment.py on lines 908..912
                                                                  myems-api/core/combinedequipment.py on lines 923..927
                                                                  myems-api/core/combinedequipment.py on lines 930..934
                                                                  myems-api/core/combinedequipment.py on lines 1289..1293
                                                                  myems-api/core/combinedequipment.py on lines 1304..1308
                                                                  myems-api/core/combinedequipment.py on lines 1311..1315
                                                                  myems-api/core/energyflowdiagram.py on lines 538..542
                                                                  myems-api/core/energyflowdiagram.py on lines 839..843
                                                                  myems-api/core/energyflowdiagram.py on lines 1463..1467
                                                                  myems-api/core/equipment.py on lines 747..751
                                                                  myems-api/core/equipment.py on lines 769..773
                                                                  myems-api/core/equipment.py on lines 1115..1119
                                                                  myems-api/core/equipment.py on lines 1130..1134
                                                                  myems-api/core/equipment.py on lines 1137..1141

                                                                  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 'numerator_meter_uuid' in new_values['data'].keys():
                                                                              if new_values['data']['numerator_meter_uuid'] is not None and \
                                                                                      isinstance(new_values['data']['numerator_meter_uuid'], str) and \
                                                                                      len(str.strip(new_values['data']['numerator_meter_uuid'])) > 0:
                                                                                  numerator_meter_uuid = str.strip(new_values['data']['numerator_meter_uuid'])
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 14 other locations - About 7 hrs to fix
                                                                  myems-api/core/combinedequipment.py on lines 908..912
                                                                  myems-api/core/combinedequipment.py on lines 923..927
                                                                  myems-api/core/combinedequipment.py on lines 930..934
                                                                  myems-api/core/combinedequipment.py on lines 1289..1293
                                                                  myems-api/core/combinedequipment.py on lines 1304..1308
                                                                  myems-api/core/combinedequipment.py on lines 1311..1315
                                                                  myems-api/core/energyflowdiagram.py on lines 538..542
                                                                  myems-api/core/energyflowdiagram.py on lines 839..843
                                                                  myems-api/core/energyflowdiagram.py on lines 1463..1467
                                                                  myems-api/core/equipment.py on lines 747..751
                                                                  myems-api/core/equipment.py on lines 762..766
                                                                  myems-api/core/equipment.py on lines 769..773
                                                                  myems-api/core/equipment.py on lines 1115..1119
                                                                  myems-api/core/equipment.py on lines 1137..1141

                                                                  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 'constant' in new_values['data'].keys():
                                                                              if new_values['data']['constant'] is not None and \
                                                                                      isinstance(new_values['data']['constant'], str) and \
                                                                                      len(str.strip(new_values['data']['constant'])) > 0:
                                                                                  constant = str.strip(new_values['data']['constant'])
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 14 other locations - About 7 hrs to fix
                                                                  myems-api/core/combinedequipment.py on lines 908..912
                                                                  myems-api/core/combinedequipment.py on lines 923..927
                                                                  myems-api/core/combinedequipment.py on lines 930..934
                                                                  myems-api/core/combinedequipment.py on lines 1289..1293
                                                                  myems-api/core/combinedequipment.py on lines 1304..1308
                                                                  myems-api/core/combinedequipment.py on lines 1311..1315
                                                                  myems-api/core/energyflowdiagram.py on lines 538..542
                                                                  myems-api/core/energyflowdiagram.py on lines 839..843
                                                                  myems-api/core/energyflowdiagram.py on lines 1463..1467
                                                                  myems-api/core/equipment.py on lines 747..751
                                                                  myems-api/core/equipment.py on lines 762..766
                                                                  myems-api/core/equipment.py on lines 769..773
                                                                  myems-api/core/equipment.py on lines 1130..1134
                                                                  myems-api/core/equipment.py on lines 1137..1141

                                                                  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 'denominator_meter_uuid' in new_values['data'].keys():
                                                                              if new_values['data']['denominator_meter_uuid'] is not None and \
                                                                                      isinstance(new_values['data']['denominator_meter_uuid'], str) and \
                                                                                      len(str.strip(new_values['data']['denominator_meter_uuid'])) > 0:
                                                                                  denominator_meter_uuid = str.strip(new_values['data']['denominator_meter_uuid'])
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 14 other locations - About 7 hrs to fix
                                                                  myems-api/core/combinedequipment.py on lines 908..912
                                                                  myems-api/core/combinedequipment.py on lines 923..927
                                                                  myems-api/core/combinedequipment.py on lines 930..934
                                                                  myems-api/core/combinedequipment.py on lines 1289..1293
                                                                  myems-api/core/combinedequipment.py on lines 1304..1308
                                                                  myems-api/core/combinedequipment.py on lines 1311..1315
                                                                  myems-api/core/energyflowdiagram.py on lines 538..542
                                                                  myems-api/core/energyflowdiagram.py on lines 839..843
                                                                  myems-api/core/energyflowdiagram.py on lines 1463..1467
                                                                  myems-api/core/equipment.py on lines 747..751
                                                                  myems-api/core/equipment.py on lines 762..766
                                                                  myems-api/core/equipment.py on lines 1115..1119
                                                                  myems-api/core/equipment.py on lines 1130..1134
                                                                  myems-api/core/equipment.py on lines 1137..1141

                                                                  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 'denominator_meter_uuid' in new_values['data'].keys():
                                                                              if new_values['data']['denominator_meter_uuid'] is not None and \
                                                                                      isinstance(new_values['data']['denominator_meter_uuid'], str) and \
                                                                                      len(str.strip(new_values['data']['denominator_meter_uuid'])) > 0:
                                                                                  denominator_meter_uuid = str.strip(new_values['data']['denominator_meter_uuid'])
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 14 other locations - About 7 hrs to fix
                                                                  myems-api/core/combinedequipment.py on lines 908..912
                                                                  myems-api/core/combinedequipment.py on lines 923..927
                                                                  myems-api/core/combinedequipment.py on lines 930..934
                                                                  myems-api/core/combinedequipment.py on lines 1289..1293
                                                                  myems-api/core/combinedequipment.py on lines 1304..1308
                                                                  myems-api/core/combinedequipment.py on lines 1311..1315
                                                                  myems-api/core/energyflowdiagram.py on lines 538..542
                                                                  myems-api/core/energyflowdiagram.py on lines 839..843
                                                                  myems-api/core/energyflowdiagram.py on lines 1463..1467
                                                                  myems-api/core/equipment.py on lines 747..751
                                                                  myems-api/core/equipment.py on lines 762..766
                                                                  myems-api/core/equipment.py on lines 769..773
                                                                  myems-api/core/equipment.py on lines 1115..1119
                                                                  myems-api/core/equipment.py on lines 1130..1134

                                                                  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 'constant' in new_values['data'].keys():
                                                                              if new_values['data']['constant'] is not None and \
                                                                                      isinstance(new_values['data']['constant'], str) and \
                                                                                      len(str.strip(new_values['data']['constant'])) > 0:
                                                                                  constant = str.strip(new_values['data']['constant'])
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 14 other locations - About 7 hrs to fix
                                                                  myems-api/core/combinedequipment.py on lines 908..912
                                                                  myems-api/core/combinedequipment.py on lines 923..927
                                                                  myems-api/core/combinedequipment.py on lines 930..934
                                                                  myems-api/core/combinedequipment.py on lines 1289..1293
                                                                  myems-api/core/combinedequipment.py on lines 1304..1308
                                                                  myems-api/core/combinedequipment.py on lines 1311..1315
                                                                  myems-api/core/energyflowdiagram.py on lines 538..542
                                                                  myems-api/core/energyflowdiagram.py on lines 839..843
                                                                  myems-api/core/energyflowdiagram.py on lines 1463..1467
                                                                  myems-api/core/equipment.py on lines 762..766
                                                                  myems-api/core/equipment.py on lines 769..773
                                                                  myems-api/core/equipment.py on lines 1115..1119
                                                                  myems-api/core/equipment.py on lines 1130..1134
                                                                  myems-api/core/equipment.py on lines 1137..1141

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

                                                                              if rows is not None and len(rows) > 0:
                                                                                  for row in rows:
                                                                                      result = {"id": row[0],
                                                                                                "name": row[1],
                                                                                                "uuid": row[2],
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 11 other locations - About 6 hrs to fix
                                                                  myems-api/core/combinedequipment.py on lines 2355..2361
                                                                  myems-api/core/combinedequipment.py on lines 2383..2389
                                                                  myems-api/core/combinedequipment.py on lines 2411..2417
                                                                  myems-api/core/combinedequipment.py on lines 3018..3024
                                                                  myems-api/core/combinedequipment.py on lines 3046..3052
                                                                  myems-api/core/combinedequipment.py on lines 3074..3080
                                                                  myems-api/core/equipment.py on lines 2155..2163
                                                                  myems-api/core/equipment.py on lines 2189..2197
                                                                  myems-api/core/equipment.py on lines 2747..2755
                                                                  myems-api/core/equipment.py on lines 2764..2772
                                                                  myems-api/core/equipment.py on lines 2781..2789

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

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                              if rows is not None and len(rows) > 0:
                                                                                  for row in rows:
                                                                                      result = {"id": row[0],
                                                                                                "name": row[1],
                                                                                                "uuid": row[2],
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 11 other locations - About 6 hrs to fix
                                                                  myems-api/core/combinedequipment.py on lines 2355..2361
                                                                  myems-api/core/combinedequipment.py on lines 2383..2389
                                                                  myems-api/core/combinedequipment.py on lines 2411..2417
                                                                  myems-api/core/combinedequipment.py on lines 3018..3024
                                                                  myems-api/core/combinedequipment.py on lines 3046..3052
                                                                  myems-api/core/combinedequipment.py on lines 3074..3080
                                                                  myems-api/core/equipment.py on lines 2155..2163
                                                                  myems-api/core/equipment.py on lines 2172..2180
                                                                  myems-api/core/equipment.py on lines 2747..2755
                                                                  myems-api/core/equipment.py on lines 2764..2772
                                                                  myems-api/core/equipment.py on lines 2781..2789

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

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                              if rows is not None and len(rows) > 0:
                                                                                  for row in rows:
                                                                                      result = {"id": row[0],
                                                                                                "name": row[1],
                                                                                                "uuid": row[2],
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 11 other locations - About 6 hrs to fix
                                                                  myems-api/core/combinedequipment.py on lines 2355..2361
                                                                  myems-api/core/combinedequipment.py on lines 2383..2389
                                                                  myems-api/core/combinedequipment.py on lines 2411..2417
                                                                  myems-api/core/combinedequipment.py on lines 3018..3024
                                                                  myems-api/core/combinedequipment.py on lines 3046..3052
                                                                  myems-api/core/combinedequipment.py on lines 3074..3080
                                                                  myems-api/core/equipment.py on lines 2155..2163
                                                                  myems-api/core/equipment.py on lines 2172..2180
                                                                  myems-api/core/equipment.py on lines 2189..2197
                                                                  myems-api/core/equipment.py on lines 2764..2772
                                                                  myems-api/core/equipment.py on lines 2781..2789

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

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                              if rows is not None and len(rows) > 0:
                                                                                  for row in rows:
                                                                                      result = {"id": row[0],
                                                                                                "name": row[1],
                                                                                                "uuid": row[2],
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 11 other locations - About 6 hrs to fix
                                                                  myems-api/core/combinedequipment.py on lines 2355..2361
                                                                  myems-api/core/combinedequipment.py on lines 2383..2389
                                                                  myems-api/core/combinedequipment.py on lines 2411..2417
                                                                  myems-api/core/combinedequipment.py on lines 3018..3024
                                                                  myems-api/core/combinedequipment.py on lines 3046..3052
                                                                  myems-api/core/combinedequipment.py on lines 3074..3080
                                                                  myems-api/core/equipment.py on lines 2155..2163
                                                                  myems-api/core/equipment.py on lines 2172..2180
                                                                  myems-api/core/equipment.py on lines 2189..2197
                                                                  myems-api/core/equipment.py on lines 2747..2755
                                                                  myems-api/core/equipment.py on lines 2764..2772

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

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                              if rows is not None and len(rows) > 0:
                                                                                  for row in rows:
                                                                                      result = {"id": row[0],
                                                                                                "name": row[1],
                                                                                                "uuid": row[2],
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 11 other locations - About 6 hrs to fix
                                                                  myems-api/core/combinedequipment.py on lines 2355..2361
                                                                  myems-api/core/combinedequipment.py on lines 2383..2389
                                                                  myems-api/core/combinedequipment.py on lines 2411..2417
                                                                  myems-api/core/combinedequipment.py on lines 3018..3024
                                                                  myems-api/core/combinedequipment.py on lines 3046..3052
                                                                  myems-api/core/combinedequipment.py on lines 3074..3080
                                                                  myems-api/core/equipment.py on lines 2155..2163
                                                                  myems-api/core/equipment.py on lines 2172..2180
                                                                  myems-api/core/equipment.py on lines 2189..2197
                                                                  myems-api/core/equipment.py on lines 2747..2755
                                                                  myems-api/core/equipment.py on lines 2781..2789

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

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

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

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

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

                                                                  Refactorings

                                                                  Further Reading

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

                                                                              if rows is not None and len(rows) > 0:
                                                                                  for row in rows:
                                                                                      result = {"id": row[0],
                                                                                                "name": row[1],
                                                                                                "uuid": row[2],
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 11 other locations - About 6 hrs to fix
                                                                  myems-api/core/combinedequipment.py on lines 2355..2361
                                                                  myems-api/core/combinedequipment.py on lines 2383..2389
                                                                  myems-api/core/combinedequipment.py on lines 2411..2417
                                                                  myems-api/core/combinedequipment.py on lines 3018..3024
                                                                  myems-api/core/combinedequipment.py on lines 3046..3052
                                                                  myems-api/core/combinedequipment.py on lines 3074..3080
                                                                  myems-api/core/equipment.py on lines 2172..2180
                                                                  myems-api/core/equipment.py on lines 2189..2197
                                                                  myems-api/core/equipment.py on lines 2747..2755
                                                                  myems-api/core/equipment.py on lines 2764..2772
                                                                  myems-api/core/equipment.py on lines 2781..2789

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

                                                                  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

                                                                              meta_result = {"id": row[0],
                                                                                             "name": row[1],
                                                                                             "uuid": row[2],
                                                                                             "is_input_counted": bool(row[3]),
                                                                                             "is_output_counted": bool(row[4]),
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 1 other location - About 6 hrs to fix
                                                                  myems-api/core/equipment.py on lines 2104..2117

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

                                                                  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

                                                                              meta_result = {"id": row[0],
                                                                                             "name": row[1],
                                                                                             "uuid": row[2],
                                                                                             "is_input_counted": bool(row[3]),
                                                                                             "is_output_counted": bool(row[4]),
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 1 other location - About 6 hrs to fix
                                                                  myems-api/core/equipment.py on lines 2696..2709

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

                                                                  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 915..920
                                                                  myems-api/core/combinedequipment.py on lines 1296..1301
                                                                  myems-api/core/energyflowdiagram.py on lines 522..527
                                                                  myems-api/core/energyflowdiagram.py on lines 530..535
                                                                  myems-api/core/energyflowdiagram.py on lines 823..828
                                                                  myems-api/core/energyflowdiagram.py on lines 831..836
                                                                  myems-api/core/energyflowdiagram.py on lines 1447..1452
                                                                  myems-api/core/energyflowdiagram.py on lines 1455..1460
                                                                  myems-api/core/equipment.py on lines 1122..1127

                                                                  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 915..920
                                                                  myems-api/core/combinedequipment.py on lines 1296..1301
                                                                  myems-api/core/energyflowdiagram.py on lines 522..527
                                                                  myems-api/core/energyflowdiagram.py on lines 530..535
                                                                  myems-api/core/energyflowdiagram.py on lines 823..828
                                                                  myems-api/core/energyflowdiagram.py on lines 831..836
                                                                  myems-api/core/energyflowdiagram.py on lines 1447..1452
                                                                  myems-api/core/energyflowdiagram.py on lines 1455..1460
                                                                  myems-api/core/equipment.py on lines 754..759

                                                                  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

                                                                          if row is None:
                                                                              raise falcon.HTTPError(status=falcon.HTTP_404, title='API.NOT_FOUND',
                                                                                                     description='API.EQUIPMENT_NOT_FOUND')
                                                                          else:
                                                                              add_values = (" INSERT INTO tbl_equipments "
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 1 other location - About 5 hrs to fix
                                                                  myems-api/core/combinedequipment.py on lines 434..454

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

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

                                                                                  if parameters['parameter_type'] == 'point':
                                                                                      if point_id is None:
                                                                                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                                                                 description='API.INVALID_POINT_ID')
                                                                                      query = (" SELECT id, name "
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 2 other locations - About 5 hrs to fix
                                                                  myems-api/core/equipment.py on lines 796..807
                                                                  myems-api/core/equipment.py on lines 3043..3054

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

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

                                                                                      if parameters['parameter_type'] == 'point':
                                                                                          if point_id is None:
                                                                                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                                                                     description='API.INVALID_POINT_ID')
                                                                                          query = (" SELECT id, name "
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 2 other locations - About 5 hrs to fix
                                                                  myems-api/core/equipment.py on lines 796..807
                                                                  myems-api/core/equipment.py on lines 2543..2554

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

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

                                                                              if rows is not None and len(rows) > 0:
                                                                                  for row in rows:
                                                                                      result = {"id": row[0],
                                                                                                "name": row[1],
                                                                                                "uuid": row[2]}
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 45 other locations - About 4 hrs to fix
                                                                  myems-api/core/combinedequipment.py on lines 2315..2319
                                                                  myems-api/core/combinedequipment.py on lines 2329..2333
                                                                  myems-api/core/combinedequipment.py on lines 2978..2982
                                                                  myems-api/core/combinedequipment.py on lines 2992..2996
                                                                  myems-api/core/distributionsystem.py on lines 579..583
                                                                  myems-api/core/equipment.py on lines 2719..2725
                                                                  myems-api/core/shopfloor.py on lines 2017..2021
                                                                  myems-api/core/shopfloor.py on lines 2030..2034
                                                                  myems-api/core/shopfloor.py on lines 2155..2159
                                                                  myems-api/core/shopfloor.py on lines 2168..2172
                                                                  myems-api/core/shopfloor.py on lines 2580..2584
                                                                  myems-api/core/shopfloor.py on lines 2593..2597
                                                                  myems-api/core/shopfloor.py on lines 2718..2722
                                                                  myems-api/core/shopfloor.py on lines 2731..2735
                                                                  myems-api/core/space.py on lines 3593..3597
                                                                  myems-api/core/space.py on lines 3684..3688
                                                                  myems-api/core/space.py on lines 3697..3701
                                                                  myems-api/core/space.py on lines 3710..3714
                                                                  myems-api/core/space.py on lines 3748..3752
                                                                  myems-api/core/space.py on lines 3761..3765
                                                                  myems-api/core/space.py on lines 3774..3778
                                                                  myems-api/core/space.py on lines 3787..3791
                                                                  myems-api/core/space.py on lines 4507..4511
                                                                  myems-api/core/space.py on lines 4598..4602
                                                                  myems-api/core/space.py on lines 4611..4615
                                                                  myems-api/core/space.py on lines 4624..4628
                                                                  myems-api/core/space.py on lines 4662..4666
                                                                  myems-api/core/space.py on lines 4675..4679
                                                                  myems-api/core/space.py on lines 4688..4692
                                                                  myems-api/core/space.py on lines 4701..4705
                                                                  myems-api/core/store.py on lines 1975..1979
                                                                  myems-api/core/store.py on lines 2091..2095
                                                                  myems-api/core/store.py on lines 2104..2108
                                                                  myems-api/core/store.py on lines 2553..2557
                                                                  myems-api/core/store.py on lines 2567..2571
                                                                  myems-api/core/store.py on lines 2580..2584
                                                                  myems-api/core/store.py on lines 2593..2597
                                                                  myems-api/core/store.py on lines 2631..2635
                                                                  myems-api/core/store.py on lines 2644..2648
                                                                  myems-api/core/tenant.py on lines 2092..2096
                                                                  myems-api/core/tenant.py on lines 2212..2216
                                                                  myems-api/core/tenant.py on lines 2225..2229
                                                                  myems-api/core/tenant.py on lines 2720..2724
                                                                  myems-api/core/tenant.py on lines 2840..2844
                                                                  myems-api/core/tenant.py on lines 2853..2857

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

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

                                                                              if rows is not None and len(rows) > 0:
                                                                                  for row in rows:
                                                                                      result = {"id": row[0],
                                                                                                "name": row[1],
                                                                                                "uuid": row[2]}
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 45 other locations - About 4 hrs to fix
                                                                  myems-api/core/combinedequipment.py on lines 2315..2319
                                                                  myems-api/core/combinedequipment.py on lines 2329..2333
                                                                  myems-api/core/combinedequipment.py on lines 2978..2982
                                                                  myems-api/core/combinedequipment.py on lines 2992..2996
                                                                  myems-api/core/distributionsystem.py on lines 579..583
                                                                  myems-api/core/equipment.py on lines 2127..2133
                                                                  myems-api/core/shopfloor.py on lines 2017..2021
                                                                  myems-api/core/shopfloor.py on lines 2030..2034
                                                                  myems-api/core/shopfloor.py on lines 2155..2159
                                                                  myems-api/core/shopfloor.py on lines 2168..2172
                                                                  myems-api/core/shopfloor.py on lines 2580..2584
                                                                  myems-api/core/shopfloor.py on lines 2593..2597
                                                                  myems-api/core/shopfloor.py on lines 2718..2722
                                                                  myems-api/core/shopfloor.py on lines 2731..2735
                                                                  myems-api/core/space.py on lines 3593..3597
                                                                  myems-api/core/space.py on lines 3684..3688
                                                                  myems-api/core/space.py on lines 3697..3701
                                                                  myems-api/core/space.py on lines 3710..3714
                                                                  myems-api/core/space.py on lines 3748..3752
                                                                  myems-api/core/space.py on lines 3761..3765
                                                                  myems-api/core/space.py on lines 3774..3778
                                                                  myems-api/core/space.py on lines 3787..3791
                                                                  myems-api/core/space.py on lines 4507..4511
                                                                  myems-api/core/space.py on lines 4598..4602
                                                                  myems-api/core/space.py on lines 4611..4615
                                                                  myems-api/core/space.py on lines 4624..4628
                                                                  myems-api/core/space.py on lines 4662..4666
                                                                  myems-api/core/space.py on lines 4675..4679
                                                                  myems-api/core/space.py on lines 4688..4692
                                                                  myems-api/core/space.py on lines 4701..4705
                                                                  myems-api/core/store.py on lines 1975..1979
                                                                  myems-api/core/store.py on lines 2091..2095
                                                                  myems-api/core/store.py on lines 2104..2108
                                                                  myems-api/core/store.py on lines 2553..2557
                                                                  myems-api/core/store.py on lines 2567..2571
                                                                  myems-api/core/store.py on lines 2580..2584
                                                                  myems-api/core/store.py on lines 2593..2597
                                                                  myems-api/core/store.py on lines 2631..2635
                                                                  myems-api/core/store.py on lines 2644..2648
                                                                  myems-api/core/tenant.py on lines 2092..2096
                                                                  myems-api/core/tenant.py on lines 2212..2216
                                                                  myems-api/core/tenant.py on lines 2225..2229
                                                                  myems-api/core/tenant.py on lines 2720..2724
                                                                  myems-api/core/tenant.py on lines 2840..2844
                                                                  myems-api/core/tenant.py on lines 2853..2857

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

                                                                  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

                                                                              cursor.execute(add_values, (new_name,
                                                                                                          str(uuid.uuid4()),
                                                                                                          meta_result['is_input_counted'],
                                                                                                          meta_result['is_output_counted'],
                                                                                                          meta_result['cost_center']['id'],
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 1 other location - About 3 hrs to fix
                                                                  myems-api/core/combinedequipment.py on lines 3192..3199

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

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

                                                                          if 'is_input_counted' not in new_values.keys() or \
                                                                                  not isinstance(new_values['is_input_counted'], bool):
                                                                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 19 other locations - About 2 hrs to fix
                                                                  myems-api/core/advancedreport.py on lines 521..523
                                                                  myems-api/core/advancedreport.py on lines 545..547
                                                                  myems-api/core/combinedequipment.py on lines 2556..2558
                                                                  myems-api/core/combinedequipment.py on lines 2562..2564
                                                                  myems-api/core/equipment.py on lines 2340..2342
                                                                  myems-api/core/meter.py on lines 1484..1486
                                                                  myems-api/core/offlinemeter.py on lines 769..771
                                                                  myems-api/core/point.py on lines 1023..1025
                                                                  myems-api/core/point.py on lines 1029..1031
                                                                  myems-api/core/rule.py on lines 642..644
                                                                  myems-api/core/rule.py on lines 648..650
                                                                  myems-api/core/shopfloor.py on lines 2218..2220
                                                                  myems-api/core/space.py on lines 3850..3852
                                                                  myems-api/core/space.py on lines 3856..3858
                                                                  myems-api/core/store.py on lines 2186..2188
                                                                  myems-api/core/tenant.py on lines 2303..2305
                                                                  myems-api/core/tenant.py on lines 2309..2311
                                                                  myems-api/core/tenant.py on lines 2322..2324
                                                                  myems-api/core/virtualmeter.py on lines 1052..1053

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

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

                                                                          if 'is_output_counted' not in new_values.keys() or \
                                                                                  not isinstance(new_values['is_output_counted'], bool):
                                                                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 19 other locations - About 2 hrs to fix
                                                                  myems-api/core/advancedreport.py on lines 521..523
                                                                  myems-api/core/advancedreport.py on lines 545..547
                                                                  myems-api/core/combinedequipment.py on lines 2556..2558
                                                                  myems-api/core/combinedequipment.py on lines 2562..2564
                                                                  myems-api/core/equipment.py on lines 2334..2336
                                                                  myems-api/core/meter.py on lines 1484..1486
                                                                  myems-api/core/offlinemeter.py on lines 769..771
                                                                  myems-api/core/point.py on lines 1023..1025
                                                                  myems-api/core/point.py on lines 1029..1031
                                                                  myems-api/core/rule.py on lines 642..644
                                                                  myems-api/core/rule.py on lines 648..650
                                                                  myems-api/core/shopfloor.py on lines 2218..2220
                                                                  myems-api/core/space.py on lines 3850..3852
                                                                  myems-api/core/space.py on lines 3856..3858
                                                                  myems-api/core/store.py on lines 2186..2188
                                                                  myems-api/core/tenant.py on lines 2303..2305
                                                                  myems-api/core/tenant.py on lines 2309..2311
                                                                  myems-api/core/tenant.py on lines 2322..2324
                                                                  myems-api/core/virtualmeter.py on lines 1052..1053

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

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

                                                                              new_name = (str.strip(meta_result['name'])
                                                                                          + (datetime.now()
                                                                                             + timedelta(minutes=timezone_offset)).isoformat(sep='-', timespec='seconds'))
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 26 other locations - About 2 hrs to fix
                                                                  myems-api/core/advancedreport.py on lines 643..645
                                                                  myems-api/core/combinedequipment.py on lines 3185..3187
                                                                  myems-api/core/command.py on lines 672..674
                                                                  myems-api/core/datasource.py on lines 851..852
                                                                  myems-api/core/distributionsystem.py on lines 590..592
                                                                  myems-api/core/energyflowdiagram.py on lines 1696..1698
                                                                  myems-api/core/energystoragepowerstation.py on lines 931..932
                                                                  myems-api/core/energystoragepowerstation.py on lines 1206..1207
                                                                  myems-api/core/gateway.py on lines 499..501
                                                                  myems-api/core/meter.py on lines 1473..1474
                                                                  myems-api/core/meter.py on lines 1756..1757
                                                                  myems-api/core/microgrid.py on lines 5680..5682
                                                                  myems-api/core/offlinemeter.py on lines 974..976
                                                                  myems-api/core/photovoltaicpowerstation.py on lines 800..802
                                                                  myems-api/core/point.py on lines 1160..1162
                                                                  myems-api/core/rule.py on lines 757..759
                                                                  myems-api/core/sensor.py on lines 682..684
                                                                  myems-api/core/shopfloor.py on lines 2739..2741
                                                                  myems-api/core/space.py on lines 4709..4711
                                                                  myems-api/core/store.py on lines 2652..2654
                                                                  myems-api/core/tariff.py on lines 727..729
                                                                  myems-api/core/tenant.py on lines 2861..2863
                                                                  myems-api/core/virtualmeter.py on lines 1364..1366
                                                                  myems-api/core/virtualpowerplant.py on lines 823..825
                                                                  myems-api/core/windfarm.py on lines 792..794
                                                                  myems-api/core/workingcalendar.py on lines 722..724

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

                                                                  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 37 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/equipment.py and 36 other locations - About 1 hr to fix
                                                                  myems-api/core/combinedequipment.py on lines 1345..1348
                                                                  myems-api/core/energyflowdiagram.py on lines 562..565
                                                                  myems-api/core/energyflowdiagram.py on lines 875..878
                                                                  myems-api/core/energyflowdiagram.py on lines 1220..1223
                                                                  myems-api/core/energyflowdiagram.py on lines 1484..1487
                                                                  myems-api/core/meter.py on lines 412..415
                                                                  myems-api/core/meter.py on lines 548..551
                                                                  myems-api/core/meter.py on lines 562..565
                                                                  myems-api/core/meter.py on lines 576..579
                                                                  myems-api/core/meter.py on lines 591..594
                                                                  myems-api/core/meter.py on lines 607..610
                                                                  myems-api/core/meter.py on lines 621..624
                                                                  myems-api/core/meter.py on lines 635..638
                                                                  myems-api/core/meter.py on lines 828..831
                                                                  myems-api/core/offlinemeter.py on lines 357..360
                                                                  myems-api/core/point.py on lines 318..321
                                                                  myems-api/core/point.py on lines 332..335
                                                                  myems-api/core/point.py on lines 346..349
                                                                  myems-api/core/point.py on lines 360..363
                                                                  myems-api/core/point.py on lines 374..377
                                                                  myems-api/core/point.py on lines 388..391
                                                                  myems-api/core/point.py on lines 402..405
                                                                  myems-api/core/point.py on lines 416..419
                                                                  myems-api/core/point.py on lines 430..433
                                                                  myems-api/core/point.py on lines 447..450
                                                                  myems-api/core/point.py on lines 463..466
                                                                  myems-api/core/point.py on lines 493..496
                                                                  myems-api/core/point.py on lines 507..510
                                                                  myems-api/core/point.py on lines 521..524
                                                                  myems-api/core/point.py on lines 535..538
                                                                  myems-api/core/point.py on lines 549..552
                                                                  myems-api/core/point.py on lines 563..566
                                                                  myems-api/core/point.py on lines 577..580
                                                                  myems-api/core/point.py on lines 591..594
                                                                  myems-api/core/user.py on lines 1095..1098
                                                                  myems-api/core/virtualmeter.py on lines 513..516

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

                                                                                      elif parameters['parameter_type'] == 'constant':
                                                                                          if parameters['constant'] is None:
                                                                                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 2 other locations - About 45 mins to fix
                                                                  myems-api/core/equipment.py on lines 2557..2559
                                                                  myems-api/core/tariff.py on lines 580..582

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

                                                                  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

                                                                                  elif parameters['parameter_type'] == 'constant':
                                                                                      if parameters['constant'] is None:
                                                                                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 2 other locations - About 45 mins to fix
                                                                  myems-api/core/equipment.py on lines 3057..3059
                                                                  myems-api/core/tariff.py on lines 580..582

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

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

                                                                          if parameter_type not in ('constant', 'point', 'fraction'):
                                                                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 4 other locations - About 35 mins to fix
                                                                  myems-api/core/combinedequipment.py on lines 903..904
                                                                  myems-api/core/combinedequipment.py on lines 1284..1285
                                                                  myems-api/core/equipment.py on lines 742..743
                                                                  myems-api/core/notification.py on lines 32..33

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

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

                                                                          if parameter_type not in ('constant', 'point', 'fraction'):
                                                                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                  Severity: Major
                                                                  Found in myems-api/core/equipment.py and 4 other locations - About 35 mins to fix
                                                                  myems-api/core/combinedequipment.py on lines 903..904
                                                                  myems-api/core/combinedequipment.py on lines 1284..1285
                                                                  myems-api/core/equipment.py on lines 1110..1111
                                                                  myems-api/core/notification.py on lines 32..33

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

                                                                  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