myems-api/core/user.py

Summary

Maintainability
F
1 mo
Test Coverage

File user.py has 1710 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import hashlib
import os
import re
import uuid
from datetime import datetime, timedelta, timezone
Severity: Major
Found in myems-api/core/user.py - About 4 days to fix

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

        def on_put(req, resp):
            """Handles PUT requests"""
            try:
                raw_json = req.stream.read().decode('utf-8')
                new_values = json.loads(raw_json)
    Severity: Minor
    Found in myems-api/core/user.py - About 5 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        def on_get(req, resp):
            admin_control(req)
            start_datetime_local = req.params.get('startdatetime')
            end_datetime_local = req.params.get('enddatetime')
    
    
    Severity: Minor
    Found in myems-api/core/user.py - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        def on_post(req, resp):
            """Handles POST requests"""
            admin_control(req)
            # todo: add user log
            try:
    Severity: Minor
    Found in myems-api/core/user.py - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function on_put has a Cognitive Complexity of 21 (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:
    Severity: Minor
    Found in myems-api/core/user.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_put has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

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

        def on_get(req, resp):
            admin_control(req)
            cnx = mysql.connector.connect(**config.myems_user_db)
            cursor = cnx.cursor()
            query = (" SELECT u.id, u.name, u.display_name, u.uuid, "
    Severity: Minor
    Found in myems-api/core/user.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 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_post(req, resp):
            try:
                raw_json = req.stream.read().decode('utf-8')
                new_values = json.loads(raw_json)
            except Exception as ex:
    Severity: Minor
    Found in myems-api/core/user.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_put has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_put(req, resp, id_):
            """Handles POST requests"""
            admin_control(req)
    
            try:
    Severity: Minor
    Found in myems-api/core/user.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 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_post(req, resp):
            try:
                raw_json = req.stream.read().decode('utf-8')
                new_values = json.loads(raw_json)
            except Exception as ex:
    Severity: Minor
    Found in myems-api/core/user.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_put has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_put(req, resp):
            """Handles PUT requests"""
            try:
                raw_json = req.stream.read().decode('utf-8')
                new_values = json.loads(raw_json)
    Severity: Minor
    Found in myems-api/core/user.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 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def on_post(req, resp):
            """Handles POST requests"""
            admin_control(req)
            # todo: add user log
            try:
    Severity: Minor
    Found in myems-api/core/user.py - About 1 hr to fix

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

          def on_put(req, resp, id_):
              """Handles PUT requests"""
              admin_control(req)
              try:
                  raw_json = req.stream.read().decode('utf-8')
      Severity: Minor
      Found in myems-api/core/user.py - About 1 hr to fix

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

            def on_put(req, resp):
                """Handles PUT requests"""
                if 'USER-UUID' not in req.headers or \
                        not isinstance(req.headers['USER-UUID'], str) or \
                        len(str.strip(req.headers['USER-UUID'])) == 0:
        Severity: Minor
        Found in myems-api/core/user.py - About 1 hr to fix

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

              def on_put(req, resp):
                  """Handles PUT requests"""
                  if 'USER-UUID' not in req.headers or \
                          not isinstance(req.headers['USER-UUID'], str) or \
                          len(str.strip(req.headers['USER-UUID'])) == 0:
          Severity: Minor
          Found in myems-api/core/user.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 a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def on_put(req, resp):
                  """Handles PUT requests"""
                  if 'USER-UUID' not in req.headers or \
                          not isinstance(req.headers['USER-UUID'], str) or \
                          len(str.strip(req.headers['USER-UUID'])) == 0:
          Severity: Minor
          Found in myems-api/core/user.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 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def on_post(req, resp):
                  try:
                      raw_json = req.stream.read().decode('utf-8')
                      new_values = json.loads(raw_json)
                  except Exception as ex:
          Severity: Minor
          Found in myems-api/core/user.py - About 1 hr to fix

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

                def on_put(req, resp):
                    """Handles PUT requests"""
                    if 'USER-UUID' not in req.headers or \
                            not isinstance(req.headers['USER-UUID'], str) or \
                            len(str.strip(req.headers['USER-UUID'])) == 0:
            Severity: Minor
            Found in myems-api/core/user.py - About 1 hr to fix

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

                  def on_put(req, resp):
                      """Handles PUT requests"""
                      try:
                          raw_json = req.stream.read().decode('utf-8')
                          new_values = json.loads(raw_json)
              Severity: Minor
              Found in myems-api/core/user.py - About 1 hr to fix

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

                    def on_post(req, resp):
                        try:
                            raw_json = req.stream.read().decode('utf-8')
                            new_values = json.loads(raw_json)
                        except Exception as ex:
                Severity: Minor
                Found in myems-api/core/user.py - About 1 hr to fix

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

                      def on_put(req, resp, id_):
                          """Handles POST requests"""
                          admin_control(req)
                  
                          try:
                  Severity: Minor
                  Found in myems-api/core/user.py - About 1 hr to fix

                    Function on_put has 34 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:
                    Severity: Minor
                    Found in myems-api/core/user.py - About 1 hr to fix

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

                          def on_put(req, resp, id_):
                              """Handles PUT requests"""
                              admin_control(req)
                      
                              try:
                      Severity: Minor
                      Found in myems-api/core/user.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 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def on_put(req, resp, id_):
                              """Handles PUT requests"""
                              admin_control(req)
                      
                              try:
                      Severity: Minor
                      Found in myems-api/core/user.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_):
                                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_USER_ID')
                        Severity: Minor
                        Found in myems-api/core/user.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_delete has 27 lines of code (exceeds 25 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_USER_ID')
                        Severity: Minor
                        Found in myems-api/core/user.py - About 1 hr to fix

                          Function on_delete has a Cognitive Complexity of 9 (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_EMAIL_MESSAGE_ID')
                          Severity: Minor
                          Found in myems-api/core/user.py - About 55 mins to fix

                          Cognitive Complexity

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

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

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

                          Further reading

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

                              def on_put(req, resp, id_):
                                  """Handles PUT requests"""
                                  if 'USER-UUID' not in req.headers or \
                                          not isinstance(req.headers['USER-UUID'], str) or \
                                          len(str.strip(req.headers['USER-UUID'])) == 0:
                          Severity: Minor
                          Found in myems-api/core/user.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_get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def on_get(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_EMAIL_MESSAGE_ID')
                          Severity: Minor
                          Found in myems-api/core/user.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

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

                                  if 'name' in new_values['data']:
                          
                                      if not isinstance(new_values['data']['name'], str) or \
                                              len(str.strip(new_values['data']['name'])) == 0:
                                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                          Severity: Major
                          Found in myems-api/core/user.py and 1 other location - About 2 days to fix
                          myems-api/core/user.py on lines 533..561

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

                          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

                                  elif 'email' in new_values['data']:
                                      if not isinstance(new_values['data']['email'], str) or \
                                              len(str.strip(new_values['data']['email'])) == 0:
                                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                 description='API.INVALID_EMAIL')
                          Severity: Major
                          Found in myems-api/core/user.py and 1 other location - About 2 days to fix
                          myems-api/core/user.py on lines 502..531

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  result = {"id": row[0],
                                            "name": row[1],
                                            "display_name": row[2],
                                            "uuid": row[3],
                                            "email": row[4],
                          Severity: Major
                          Found in myems-api/core/user.py and 1 other location - About 2 days to fix
                          myems-api/core/user.py on lines 46..62

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                                          meta_result = {"id": row[0],
                                                         "name": row[1],
                                                         "display_name": row[2],
                                                         "uuid": row[3],
                                                         "email": row[4],
                          Severity: Major
                          Found in myems-api/core/user.py and 1 other location - About 2 days to fix
                          myems-api/core/user.py on lines 254..270

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

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

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

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

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

                          Refactorings

                          Further Reading

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

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

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 210.

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  result = {"id": row[0],
                                            "recipient_name": row[1],
                                            "recipient_email": row[2],
                                            "subject": row[3],
                                            "message": row[4].replace("<br>", ""),
                          Severity: Major
                          Found in myems-api/core/user.py and 1 other location - About 1 day to fix
                          myems-api/core/user.py on lines 1195..1203

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                                          meta_result = {"id": row[0],
                                                         "recipient_name": row[1],
                                                         "recipient_email": row[2],
                                                         "subject": row[3],
                                                         "message": row[4].replace("<br>", ""),
                          Severity: Major
                          Found in myems-api/core/user.py and 1 other location - About 1 day to fix
                          myems-api/core/user.py on lines 1373..1380

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

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

                                  if 'status' not in new_values['data'].keys() or \
                                          not isinstance(new_values['data']['status'], str) or \
                                          len(str.strip(new_values['data']['status'])) == 0 or \
                                          str.strip(new_values['data']['status']) not in ('new', 'acknowledged', 'timeout'):
                                      raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                          Severity: Major
                          Found in myems-api/core/user.py and 6 other locations - About 1 day to fix
                          myems-api/core/emailmessage.py on lines 356..360
                          myems-api/core/notification.py on lines 274..278
                          myems-api/core/textmessage.py on lines 327..331
                          myems-api/core/webmessage.py on lines 300..304
                          myems-api/core/webmessage.py on lines 526..530
                          myems-api/core/wechatmessage.py on lines 375..379

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

                          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 'privilege_id' in new_values['data'].keys():
                                      if not isinstance(new_values['data']['privilege_id'], int) or \
                                              new_values['data']['privilege_id'] <= 0:
                                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                 description='API.INVALID_PRIVILEGE_ID')
                          Severity: Major
                          Found in myems-api/core/user.py and 3 other locations - About 7 hrs to fix
                          myems-api/core/meter.py on lines 172..179
                          myems-api/core/user.py on lines 131..138
                          myems-api/core/user.py on lines 383..390

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

                          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 'privilege_id' in new_values['data'].keys():
                                      if not isinstance(new_values['data']['privilege_id'], int) or \
                                              new_values['data']['privilege_id'] <= 0:
                                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                 description='API.INVALID_PRIVILEGE_ID')
                          Severity: Major
                          Found in myems-api/core/user.py and 3 other locations - About 7 hrs to fix
                          myems-api/core/meter.py on lines 172..179
                          myems-api/core/user.py on lines 131..138
                          myems-api/core/user.py on lines 1948..1955

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

                          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 'privilege_id' in new_values['data'].keys():
                                      if not isinstance(new_values['data']['privilege_id'], int) or \
                                              new_values['data']['privilege_id'] <= 0:
                                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                 description='API.INVALID_PRIVILEGE_ID')
                          Severity: Major
                          Found in myems-api/core/user.py and 3 other locations - About 7 hrs to fix
                          myems-api/core/meter.py on lines 172..179
                          myems-api/core/user.py on lines 383..390
                          myems-api/core/user.py on lines 1948..1955

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

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

                                  if 'old_password' not in new_values['data'] or \
                                          not isinstance(new_values['data']['old_password'], str) or \
                                          len(str.strip(new_values['data']['old_password'])) == 0:
                                      raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                          Severity: Major
                          Found in myems-api/core/user.py and 7 other locations - About 5 hrs to fix
                          myems-api/core/privilege.py on lines 54..57
                          myems-api/core/privilege.py on lines 61..64
                          myems-api/core/privilege.py on lines 160..163
                          myems-api/core/privilege.py on lines 167..170
                          myems-api/core/user.py on lines 739..742
                          myems-api/core/user.py on lines 856..859
                          myems-api/core/user.py on lines 863..866

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

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

                                  if 'new_password' not in new_values['data'] or \
                                          not isinstance(new_values['data']['new_password'], str) or \
                                          len(str.strip(new_values['data']['new_password'])) == 0:
                                      raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                          Severity: Major
                          Found in myems-api/core/user.py and 7 other locations - About 5 hrs to fix
                          myems-api/core/privilege.py on lines 54..57
                          myems-api/core/privilege.py on lines 61..64
                          myems-api/core/privilege.py on lines 160..163
                          myems-api/core/privilege.py on lines 167..170
                          myems-api/core/user.py on lines 728..731
                          myems-api/core/user.py on lines 856..859
                          myems-api/core/user.py on lines 863..866

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

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

                                  if 'name' not in new_values['data'] or \
                                          not isinstance(new_values['data']['name'], str) or \
                                          len(str.strip(new_values['data']['name'])) == 0:
                                      raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                          Severity: Major
                          Found in myems-api/core/user.py and 7 other locations - About 5 hrs to fix
                          myems-api/core/privilege.py on lines 54..57
                          myems-api/core/privilege.py on lines 61..64
                          myems-api/core/privilege.py on lines 160..163
                          myems-api/core/privilege.py on lines 167..170
                          myems-api/core/user.py on lines 728..731
                          myems-api/core/user.py on lines 739..742
                          myems-api/core/user.py on lines 863..866

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

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

                                  if 'password' not in new_values['data'] or \
                                          not isinstance(new_values['data']['password'], str) or \
                                          len(str.strip(new_values['data']['password'])) == 0:
                                      raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                          Severity: Major
                          Found in myems-api/core/user.py and 7 other locations - About 5 hrs to fix
                          myems-api/core/privilege.py on lines 54..57
                          myems-api/core/privilege.py on lines 61..64
                          myems-api/core/privilege.py on lines 160..163
                          myems-api/core/privilege.py on lines 167..170
                          myems-api/core/user.py on lines 728..731
                          myems-api/core/user.py on lines 739..742
                          myems-api/core/user.py on lines 856..859

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

                          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 is_admin:
                                      if 'is_read_only' not in new_values['data'].keys() or \
                                             not isinstance(new_values['data']['is_read_only'], bool):
                                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                 description='API.INVALID_IS_READ_ONLY_VALUE')
                          Severity: Major
                          Found in myems-api/core/user.py and 2 other locations - About 5 hrs to fix
                          myems-api/core/user.py on lines 376..381
                          myems-api/core/user.py on lines 1941..1946

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

                          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 is_admin:
                                      if 'is_read_only' not in new_values['data'].keys() or \
                                              not isinstance(new_values['data']['is_read_only'], bool):
                                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                 description='API.INVALID_IS_READ_ONLY_VALUE')
                          Severity: Major
                          Found in myems-api/core/user.py and 2 other locations - About 5 hrs to fix
                          myems-api/core/user.py on lines 124..129
                          myems-api/core/user.py on lines 376..381

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

                          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 is_admin:
                                      if 'is_read_only' not in new_values['data'].keys() or \
                                             not isinstance(new_values['data']['is_read_only'], bool):
                                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                 description='API.INVALID_IS_READ_ONLY_VALUE')
                          Severity: Major
                          Found in myems-api/core/user.py and 2 other locations - About 5 hrs to fix
                          myems-api/core/user.py on lines 124..129
                          myems-api/core/user.py on lines 1941..1946

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

                          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 privilege_id is not None:
                                      cursor.execute(" SELECT name "
                                                     " FROM tbl_privileges "
                                                     " WHERE id = %s ",
                                                     (privilege_id,))
                          Severity: Major
                          Found in myems-api/core/user.py and 2 other locations - About 3 hrs to fix
                          myems-api/core/user.py on lines 175..183
                          myems-api/core/user.py on lines 1983..1991

                          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

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

                                  if privilege_id is not None:
                                      cursor.execute(" SELECT name "
                                                     " FROM tbl_privileges "
                                                     " WHERE id = %s ",
                                                     (privilege_id,))
                          Severity: Major
                          Found in myems-api/core/user.py and 2 other locations - About 3 hrs to fix
                          myems-api/core/user.py on lines 436..444
                          myems-api/core/user.py on lines 1983..1991

                          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

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

                                  if privilege_id is not None:
                                      cursor.execute(" SELECT name "
                                                     " FROM tbl_privileges "
                                                     " WHERE id = %s ",
                                                     (privilege_id,))
                          Severity: Major
                          Found in myems-api/core/user.py and 2 other locations - About 3 hrs to fix
                          myems-api/core/user.py on lines 175..183
                          myems-api/core/user.py on lines 436..444

                          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

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

                                  try:
                                      raw_json = req.stream.read().decode('utf-8')
                                      new_values = json.loads(raw_json)
                                  except Exception as ex:
                                      raise falcon.HTTPError(status=falcon.HTTP_400,
                          Severity: Major
                          Found in myems-api/core/user.py and 18 other locations - About 2 hrs to fix
                          myems-api/core/apikey.py on lines 55..59
                          myems-api/core/privilege.py on lines 46..50
                          myems-api/core/privilege.py on lines 149..153
                          myems-api/core/space.py on lines 116..120
                          myems-api/core/space.py on lines 3955..3959
                          myems-api/core/user.py on lines 72..76
                          myems-api/core/user.py on lines 330..334
                          myems-api/core/user.py on lines 720..724
                          myems-api/core/user.py on lines 848..852
                          myems-api/core/user.py on lines 1026..1030
                          myems-api/core/user.py on lines 1210..1214
                          myems-api/core/user.py on lines 1394..1398
                          myems-api/core/user.py on lines 1590..1594
                          myems-api/core/user.py on lines 1805..1809
                          myems-api/core/user.py on lines 1921..1925
                          myems-api/core/workingcalendar.py on lines 50..54
                          myems-api/core/workingcalendar.py on lines 329..333
                          myems-api/core/workingcalendar.py on lines 583..587

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

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

                                  try:
                                      raw_json = req.stream.read().decode('utf-8')
                                      new_values = json.loads(raw_json)
                                  except Exception as ex:
                                      raise falcon.HTTPError(status=falcon.HTTP_400,
                          Severity: Major
                          Found in myems-api/core/user.py and 18 other locations - About 2 hrs to fix
                          myems-api/core/apikey.py on lines 55..59
                          myems-api/core/privilege.py on lines 46..50
                          myems-api/core/privilege.py on lines 149..153
                          myems-api/core/space.py on lines 116..120
                          myems-api/core/space.py on lines 3955..3959
                          myems-api/core/user.py on lines 72..76
                          myems-api/core/user.py on lines 330..334
                          myems-api/core/user.py on lines 482..486
                          myems-api/core/user.py on lines 720..724
                          myems-api/core/user.py on lines 848..852
                          myems-api/core/user.py on lines 1026..1030
                          myems-api/core/user.py on lines 1394..1398
                          myems-api/core/user.py on lines 1590..1594
                          myems-api/core/user.py on lines 1805..1809
                          myems-api/core/user.py on lines 1921..1925
                          myems-api/core/workingcalendar.py on lines 50..54
                          myems-api/core/workingcalendar.py on lines 329..333
                          myems-api/core/workingcalendar.py on lines 583..587

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

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

                                  try:
                                      raw_json = req.stream.read().decode('utf-8')
                                      new_values = json.loads(raw_json)
                                  except Exception as ex:
                                      raise falcon.HTTPError(status=falcon.HTTP_400,
                          Severity: Major
                          Found in myems-api/core/user.py and 18 other locations - About 2 hrs to fix
                          myems-api/core/apikey.py on lines 55..59
                          myems-api/core/privilege.py on lines 46..50
                          myems-api/core/privilege.py on lines 149..153
                          myems-api/core/space.py on lines 116..120
                          myems-api/core/space.py on lines 3955..3959
                          myems-api/core/user.py on lines 330..334
                          myems-api/core/user.py on lines 482..486
                          myems-api/core/user.py on lines 720..724
                          myems-api/core/user.py on lines 848..852
                          myems-api/core/user.py on lines 1026..1030
                          myems-api/core/user.py on lines 1210..1214
                          myems-api/core/user.py on lines 1394..1398
                          myems-api/core/user.py on lines 1590..1594
                          myems-api/core/user.py on lines 1805..1809
                          myems-api/core/user.py on lines 1921..1925
                          myems-api/core/workingcalendar.py on lines 50..54
                          myems-api/core/workingcalendar.py on lines 329..333
                          myems-api/core/workingcalendar.py on lines 583..587

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

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

                                  try:
                                      raw_json = req.stream.read().decode('utf-8')
                                      new_values = json.loads(raw_json)
                                  except Exception as ex:
                                      raise falcon.HTTPError(status=falcon.HTTP_400,
                          Severity: Major
                          Found in myems-api/core/user.py and 18 other locations - About 2 hrs to fix
                          myems-api/core/apikey.py on lines 55..59
                          myems-api/core/privilege.py on lines 46..50
                          myems-api/core/privilege.py on lines 149..153
                          myems-api/core/space.py on lines 116..120
                          myems-api/core/space.py on lines 3955..3959
                          myems-api/core/user.py on lines 72..76
                          myems-api/core/user.py on lines 482..486
                          myems-api/core/user.py on lines 720..724
                          myems-api/core/user.py on lines 848..852
                          myems-api/core/user.py on lines 1026..1030
                          myems-api/core/user.py on lines 1210..1214
                          myems-api/core/user.py on lines 1394..1398
                          myems-api/core/user.py on lines 1590..1594
                          myems-api/core/user.py on lines 1805..1809
                          myems-api/core/user.py on lines 1921..1925
                          myems-api/core/workingcalendar.py on lines 50..54
                          myems-api/core/workingcalendar.py on lines 329..333
                          myems-api/core/workingcalendar.py on lines 583..587

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

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

                                  try:
                                      raw_json = req.stream.read().decode('utf-8')
                                      new_values = json.loads(raw_json)
                                  except Exception as ex:
                                      raise falcon.HTTPError(status=falcon.HTTP_400,
                          Severity: Major
                          Found in myems-api/core/user.py and 18 other locations - About 2 hrs to fix
                          myems-api/core/apikey.py on lines 55..59
                          myems-api/core/privilege.py on lines 46..50
                          myems-api/core/privilege.py on lines 149..153
                          myems-api/core/space.py on lines 116..120
                          myems-api/core/space.py on lines 3955..3959
                          myems-api/core/user.py on lines 72..76
                          myems-api/core/user.py on lines 330..334
                          myems-api/core/user.py on lines 482..486
                          myems-api/core/user.py on lines 720..724
                          myems-api/core/user.py on lines 1026..1030
                          myems-api/core/user.py on lines 1210..1214
                          myems-api/core/user.py on lines 1394..1398
                          myems-api/core/user.py on lines 1590..1594
                          myems-api/core/user.py on lines 1805..1809
                          myems-api/core/user.py on lines 1921..1925
                          myems-api/core/workingcalendar.py on lines 50..54
                          myems-api/core/workingcalendar.py on lines 329..333
                          myems-api/core/workingcalendar.py on lines 583..587

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

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

                                  try:
                                      raw_json = req.stream.read().decode('utf-8')
                                      new_values = json.loads(raw_json)
                                  except Exception as ex:
                                      raise falcon.HTTPError(status=falcon.HTTP_400,
                          Severity: Major
                          Found in myems-api/core/user.py and 18 other locations - About 2 hrs to fix
                          myems-api/core/apikey.py on lines 55..59
                          myems-api/core/privilege.py on lines 46..50
                          myems-api/core/privilege.py on lines 149..153
                          myems-api/core/space.py on lines 116..120
                          myems-api/core/space.py on lines 3955..3959
                          myems-api/core/user.py on lines 72..76
                          myems-api/core/user.py on lines 330..334
                          myems-api/core/user.py on lines 482..486
                          myems-api/core/user.py on lines 720..724
                          myems-api/core/user.py on lines 848..852
                          myems-api/core/user.py on lines 1026..1030
                          myems-api/core/user.py on lines 1210..1214
                          myems-api/core/user.py on lines 1590..1594
                          myems-api/core/user.py on lines 1805..1809
                          myems-api/core/user.py on lines 1921..1925
                          myems-api/core/workingcalendar.py on lines 50..54
                          myems-api/core/workingcalendar.py on lines 329..333
                          myems-api/core/workingcalendar.py on lines 583..587

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

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

                                  try:
                                      raw_json = req.stream.read().decode('utf-8')
                                      new_values = json.loads(raw_json)
                                  except Exception as ex:
                                      raise falcon.HTTPError(status=falcon.HTTP_400,
                          Severity: Major
                          Found in myems-api/core/user.py and 18 other locations - About 2 hrs to fix
                          myems-api/core/apikey.py on lines 55..59
                          myems-api/core/privilege.py on lines 46..50
                          myems-api/core/privilege.py on lines 149..153
                          myems-api/core/space.py on lines 116..120
                          myems-api/core/space.py on lines 3955..3959
                          myems-api/core/user.py on lines 72..76
                          myems-api/core/user.py on lines 330..334
                          myems-api/core/user.py on lines 482..486
                          myems-api/core/user.py on lines 848..852
                          myems-api/core/user.py on lines 1026..1030
                          myems-api/core/user.py on lines 1210..1214
                          myems-api/core/user.py on lines 1394..1398
                          myems-api/core/user.py on lines 1590..1594
                          myems-api/core/user.py on lines 1805..1809
                          myems-api/core/user.py on lines 1921..1925
                          myems-api/core/workingcalendar.py on lines 50..54
                          myems-api/core/workingcalendar.py on lines 329..333
                          myems-api/core/workingcalendar.py on lines 583..587

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

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

                                  try:
                                      raw_json = req.stream.read().decode('utf-8')
                                      new_values = json.loads(raw_json)
                                  except Exception as ex:
                                      raise falcon.HTTPError(status=falcon.HTTP_400,
                          Severity: Major
                          Found in myems-api/core/user.py and 18 other locations - About 2 hrs to fix
                          myems-api/core/apikey.py on lines 55..59
                          myems-api/core/privilege.py on lines 46..50
                          myems-api/core/privilege.py on lines 149..153
                          myems-api/core/space.py on lines 116..120
                          myems-api/core/space.py on lines 3955..3959
                          myems-api/core/user.py on lines 72..76
                          myems-api/core/user.py on lines 330..334
                          myems-api/core/user.py on lines 482..486
                          myems-api/core/user.py on lines 720..724
                          myems-api/core/user.py on lines 848..852
                          myems-api/core/user.py on lines 1026..1030
                          myems-api/core/user.py on lines 1210..1214
                          myems-api/core/user.py on lines 1394..1398
                          myems-api/core/user.py on lines 1805..1809
                          myems-api/core/user.py on lines 1921..1925
                          myems-api/core/workingcalendar.py on lines 50..54
                          myems-api/core/workingcalendar.py on lines 329..333
                          myems-api/core/workingcalendar.py on lines 583..587

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

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

                                  try:
                                      raw_json = req.stream.read().decode('utf-8')
                                      new_values = json.loads(raw_json)
                                  except Exception as ex:
                                      raise falcon.HTTPError(status=falcon.HTTP_400,
                          Severity: Major
                          Found in myems-api/core/user.py and 18 other locations - About 2 hrs to fix
                          myems-api/core/apikey.py on lines 55..59
                          myems-api/core/privilege.py on lines 46..50
                          myems-api/core/privilege.py on lines 149..153
                          myems-api/core/space.py on lines 116..120
                          myems-api/core/space.py on lines 3955..3959
                          myems-api/core/user.py on lines 72..76
                          myems-api/core/user.py on lines 330..334
                          myems-api/core/user.py on lines 482..486
                          myems-api/core/user.py on lines 720..724
                          myems-api/core/user.py on lines 848..852
                          myems-api/core/user.py on lines 1026..1030
                          myems-api/core/user.py on lines 1210..1214
                          myems-api/core/user.py on lines 1394..1398
                          myems-api/core/user.py on lines 1590..1594
                          myems-api/core/user.py on lines 1805..1809
                          myems-api/core/workingcalendar.py on lines 50..54
                          myems-api/core/workingcalendar.py on lines 329..333
                          myems-api/core/workingcalendar.py on lines 583..587

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

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

                                  try:
                                      raw_json = req.stream.read().decode('utf-8')
                                      new_values = json.loads(raw_json)
                                  except Exception as ex:
                                      raise falcon.HTTPError(status=falcon.HTTP_400,
                          Severity: Major
                          Found in myems-api/core/user.py and 18 other locations - About 2 hrs to fix
                          myems-api/core/apikey.py on lines 55..59
                          myems-api/core/privilege.py on lines 46..50
                          myems-api/core/privilege.py on lines 149..153
                          myems-api/core/space.py on lines 116..120
                          myems-api/core/space.py on lines 3955..3959
                          myems-api/core/user.py on lines 72..76
                          myems-api/core/user.py on lines 330..334
                          myems-api/core/user.py on lines 482..486
                          myems-api/core/user.py on lines 720..724
                          myems-api/core/user.py on lines 848..852
                          myems-api/core/user.py on lines 1210..1214
                          myems-api/core/user.py on lines 1394..1398
                          myems-api/core/user.py on lines 1590..1594
                          myems-api/core/user.py on lines 1805..1809
                          myems-api/core/user.py on lines 1921..1925
                          myems-api/core/workingcalendar.py on lines 50..54
                          myems-api/core/workingcalendar.py on lines 329..333
                          myems-api/core/workingcalendar.py on lines 583..587

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

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

                                  try:
                                      raw_json = req.stream.read().decode('utf-8')
                                      new_values = json.loads(raw_json)
                                  except Exception as ex:
                                      raise falcon.HTTPError(status=falcon.HTTP_400,
                          Severity: Major
                          Found in myems-api/core/user.py and 18 other locations - About 2 hrs to fix
                          myems-api/core/apikey.py on lines 55..59
                          myems-api/core/privilege.py on lines 46..50
                          myems-api/core/privilege.py on lines 149..153
                          myems-api/core/space.py on lines 116..120
                          myems-api/core/space.py on lines 3955..3959
                          myems-api/core/user.py on lines 72..76
                          myems-api/core/user.py on lines 330..334
                          myems-api/core/user.py on lines 482..486
                          myems-api/core/user.py on lines 720..724
                          myems-api/core/user.py on lines 848..852
                          myems-api/core/user.py on lines 1026..1030
                          myems-api/core/user.py on lines 1210..1214
                          myems-api/core/user.py on lines 1394..1398
                          myems-api/core/user.py on lines 1590..1594
                          myems-api/core/user.py on lines 1921..1925
                          myems-api/core/workingcalendar.py on lines 50..54
                          myems-api/core/workingcalendar.py on lines 329..333
                          myems-api/core/workingcalendar.py on lines 583..587

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

                          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 row is None:
                                      cursor_user_db.close()
                                      cnx_user_db.close()
                                      raise falcon.HTTPError(status=falcon.HTTP_404, title='API.NOT_FOUND',
                                                             description='API.USER_NOT_FOUND')
                          Severity: Major
                          Found in myems-api/core/user.py and 3 other locations - About 2 hrs to fix
                          myems-api/core/meter.py on lines 396..402
                          myems-api/core/offlinemeter.py on lines 341..347
                          myems-api/core/virtualmeter.py on lines 497..503

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

                          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 result['account_expiration_datetime_utc'] <= datetime.utcnow():
                                      cursor.close()
                                      cnx.close()
                                      raise falcon.HTTPError(status=falcon.HTTP_400,
                          Severity: Major
                          Found in myems-api/core/user.py and 1 other location - About 2 hrs to fix
                          myems-api/core/user.py on lines 608..611

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

                                  if result['password_expiration_datetime_utc'] <= datetime.utcnow():
                                      cursor.close()
                                      cnx.close()
                                      raise falcon.HTTPError(status=falcon.HTTP_400,
                          Severity: Major
                          Found in myems-api/core/user.py and 1 other location - About 2 hrs to fix
                          myems-api/core/user.py on lines 601..604

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

                                  if len(str.strip(new_values['data']['password'])) > 100:
                                      raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                          Severity: Major
                          Found in myems-api/core/user.py and 5 other locations - About 2 hrs to fix
                          myems-api/core/user.py on lines 495..496
                          myems-api/core/user.py on lines 735..736
                          myems-api/core/user.py on lines 746..747
                          myems-api/core/user.py on lines 869..870
                          myems-api/core/user.py on lines 1630..1631

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  if len(str.strip(new_values['data']['password'])) > 100:
                                      raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                          Severity: Major
                          Found in myems-api/core/user.py and 5 other locations - About 2 hrs to fix
                          myems-api/core/user.py on lines 112..113
                          myems-api/core/user.py on lines 495..496
                          myems-api/core/user.py on lines 735..736
                          myems-api/core/user.py on lines 746..747
                          myems-api/core/user.py on lines 1630..1631

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  if len(str.strip(new_values['data']['password'])) > 100:
                                      raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                          Severity: Major
                          Found in myems-api/core/user.py and 5 other locations - About 2 hrs to fix
                          myems-api/core/user.py on lines 112..113
                          myems-api/core/user.py on lines 735..736
                          myems-api/core/user.py on lines 746..747
                          myems-api/core/user.py on lines 869..870
                          myems-api/core/user.py on lines 1630..1631

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  if len(str.strip(new_values['data']['old_password'])) > 100:
                                      raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                          Severity: Major
                          Found in myems-api/core/user.py and 5 other locations - About 2 hrs to fix
                          myems-api/core/user.py on lines 112..113
                          myems-api/core/user.py on lines 495..496
                          myems-api/core/user.py on lines 746..747
                          myems-api/core/user.py on lines 869..870
                          myems-api/core/user.py on lines 1630..1631

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  if len(str.strip(new_values['data']['new_password'])) > 100:
                                      raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                          Severity: Major
                          Found in myems-api/core/user.py and 5 other locations - About 2 hrs to fix
                          myems-api/core/user.py on lines 112..113
                          myems-api/core/user.py on lines 495..496
                          myems-api/core/user.py on lines 735..736
                          myems-api/core/user.py on lines 869..870
                          myems-api/core/user.py on lines 1630..1631

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  if len(str.strip(new_values['data']['password'])) > 100:
                                      raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                          Severity: Major
                          Found in myems-api/core/user.py and 5 other locations - About 2 hrs to fix
                          myems-api/core/user.py on lines 112..113
                          myems-api/core/user.py on lines 495..496
                          myems-api/core/user.py on lines 735..736
                          myems-api/core/user.py on lines 746..747
                          myems-api/core/user.py on lines 869..870

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  result['account_expiration_datetime'] = \
                                      (result['account_expiration_datetime_utc'].replace(tzinfo=timezone.utc) +
                                       timedelta(minutes=timezone_offset)).strftime('%Y-%m-%dT%H:%M:%S')
                          Severity: Major
                          Found in myems-api/core/user.py and 1 other location - About 1 hr to fix
                          myems-api/core/user.py on lines 637..639

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  result['password_expiration_datetime'] = \
                                      (result['password_expiration_datetime_utc'].replace(tzinfo=timezone.utc) +
                                       timedelta(minutes=timezone_offset)).strftime('%Y-%m-%dT%H:%M:%S')
                          Severity: Major
                          Found in myems-api/core/user.py and 1 other location - About 1 hr to fix
                          myems-api/core/user.py on lines 632..634

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  if row is not None:
                                      cursor.close()
                                      cnx.close()
                                      raise falcon.HTTPError(status=falcon.HTTP_404, title='API.ERROR', description='API.PASSWORDS_MATCH')
                          Severity: Major
                          Found in myems-api/core/user.py and 40 other locations - About 1 hr to fix
                          myems-api/core/combinedequipment.py on lines 1384..1387
                          myems-api/core/energyflowdiagram.py on lines 559..562
                          myems-api/core/energyflowdiagram.py on lines 871..874
                          myems-api/core/energyflowdiagram.py on lines 1214..1217
                          myems-api/core/energyflowdiagram.py on lines 1476..1479
                          myems-api/core/equipment.py on lines 1215..1218
                          myems-api/core/meter.py on lines 410..413
                          myems-api/core/meter.py on lines 546..549
                          myems-api/core/meter.py on lines 560..563
                          myems-api/core/meter.py on lines 574..577
                          myems-api/core/meter.py on lines 589..592
                          myems-api/core/meter.py on lines 605..608
                          myems-api/core/meter.py on lines 619..622
                          myems-api/core/meter.py on lines 633..636
                          myems-api/core/meter.py on lines 826..829
                          myems-api/core/offlinemeter.py on lines 355..358
                          myems-api/core/point.py on lines 316..319
                          myems-api/core/point.py on lines 330..333
                          myems-api/core/point.py on lines 344..347
                          myems-api/core/point.py on lines 358..361
                          myems-api/core/point.py on lines 372..375
                          myems-api/core/point.py on lines 386..389
                          myems-api/core/point.py on lines 400..403
                          myems-api/core/point.py on lines 414..417
                          myems-api/core/point.py on lines 428..431
                          myems-api/core/point.py on lines 445..448
                          myems-api/core/point.py on lines 461..464
                          myems-api/core/point.py on lines 479..482
                          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 592..595
                          myems-api/core/point.py on lines 606..609
                          myems-api/core/point.py on lines 620..623
                          myems-api/core/point.py on lines 638..641
                          myems-api/core/virtualmeter.py on lines 511..514

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 43.

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  utc_expires = datetime.utcnow() + timedelta(seconds=1000 * 60 * 60 * 8)
                          Severity: Major
                          Found in myems-api/core/user.py and 1 other location - About 1 hr to fix
                          myems-api/core/user.py on lines 810..810

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

                          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

                                  utc_expires = datetime.utcnow() + timedelta(seconds=1000 * 60 * 60 * 8)
                          Severity: Major
                          Found in myems-api/core/user.py and 1 other location - About 1 hr to fix
                          myems-api/core/user.py on lines 932..932

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

                          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 row is not None:
                                      expires_datetime_utc = row[0]
                                      print(expires_datetime_utc)
                                      print(datetime.utcnow())
                                      if datetime.utcnow() > expires_datetime_utc:
                          Severity: Major
                          Found in myems-api/core/user.py and 3 other locations - About 40 mins to fix
                          myems-api/core/tariff.py on lines 59..77
                          myems-api/core/user.py on lines 533..566
                          myems-api/core/user.py on lines 1051..1080

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

                          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 'email' in new_values['data']:
                                      if not isinstance(new_values['data']['email'], str) or \
                                              len(str.strip(new_values['data']['email'])) == 0:
                                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                 description='API.INVALID_EMAIL')
                          Severity: Major
                          Found in myems-api/core/user.py and 3 other locations - About 40 mins to fix
                          myems-api/core/tariff.py on lines 59..77
                          myems-api/core/user.py on lines 533..566
                          myems-api/core/user.py on lines 1650..1663

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

                          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