myems-api/core/energystoragecontainer.py

Summary

Maintainability
F
9 mos
Test Coverage

File energystoragecontainer.py has 2749 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import uuid
import falcon
import mysql.connector
import simplejson as json
from core.useractivity import user_logger, admin_control, access_control
Severity: Major
Found in myems-api/core/energystoragecontainer.py - About 1 wk to fix

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

        def on_post(req, resp, id_):
            """Handles POST requests"""
            admin_control(req)
            try:
                raw_json = req.stream.read().decode('utf-8')
    Severity: Minor
    Found in myems-api/core/energystoragecontainer.py - About 6 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

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

    Cognitive Complexity

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

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

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

    Further reading

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

        def on_post(req, resp, id_):
            """Handles POST requests"""
            admin_control(req)
            try:
                raw_json = req.stream.read().decode('utf-8')
    Severity: Major
    Found in myems-api/core/energystoragecontainer.py - About 3 hrs to fix

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

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

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

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

            def on_get(req, resp, id_, pid):
                access_control(req)
                if not id_.isdigit() or int(id_) <= 0:
                    raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                           description='API.INVALID_ENERGY_STORAGE_CONTAINER_ID')
        Severity: Minor
        Found in myems-api/core/energystoragecontainer.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_get has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def on_get(req, resp, id_, gid):
                access_control(req)
                if not id_.isdigit() or int(id_) <= 0:
                    raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                           description='API.INVALID_ENERGY_STORAGE_CONTAINER_ID')
        Severity: Minor
        Found in myems-api/core/energystoragecontainer.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 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def on_get(req, resp, id_, lid):
                access_control(req)
                if not id_.isdigit() or int(id_) <= 0:
                    raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                           description='API.INVALID_ENERGY_STORAGE_CONTAINER_ID')
        Severity: Minor
        Found in myems-api/core/energystoragecontainer.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 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def on_get(req, resp, id_, bid):
                access_control(req)
                if not id_.isdigit() or int(id_) <= 0:
                    raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                           description='API.INVALID_ENERGY_STORAGE_CONTAINER_ID')
        Severity: Minor
        Found in myems-api/core/energystoragecontainer.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 17 (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/energystoragecontainer.py - About 2 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            def on_post(req, resp):
                """Handles POST requests"""
                admin_control(req)
                try:
                    raw_json = req.stream.read().decode('utf-8')
        Severity: Minor
        Found in myems-api/core/energystoragecontainer.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 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

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

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

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

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

            Cognitive Complexity

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

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

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

            Further reading

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

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

            Cognitive Complexity

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

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

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

            Further reading

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

                def on_get(req, resp, id_):
                    access_control(req)
                    if not id_.isdigit() or int(id_) <= 0:
                        raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                               description='API.INVALID_ENERGY_STORAGE_CONTAINER_ID')
            Severity: Minor
            Found in myems-api/core/energystoragecontainer.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 15 (exceeds 5 allowed). Consider refactoring.
            Open

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

            Cognitive Complexity

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

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

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

            Further reading

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

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

            Cognitive Complexity

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

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

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

            Further reading

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

                def on_get(req, resp, id_):
                    access_control(req)
                    if not id_.isdigit() or int(id_) <= 0:
                        raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                               description='API.INVALID_ENERGY_STORAGE_CONTAINER_ID')
            Severity: Minor
            Found in myems-api/core/energystoragecontainer.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, id_, lid):
                    """Handles PUT requests"""
                    admin_control(req)
                    try:
                        raw_json = req.stream.read().decode('utf-8')
            Severity: Minor
            Found in myems-api/core/energystoragecontainer.py - About 1 hr to fix

            Cognitive Complexity

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

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

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

            Further reading

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

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

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

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

                  Cognitive Complexity

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

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

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

                  Further reading

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

                      def on_get(req, resp):
                          access_control(req)
                          cnx = mysql.connector.connect(**config.myems_system_db)
                          cursor = cnx.cursor()
                  
                  
                  Severity: Minor
                  Found in myems-api/core/energystoragecontainer.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 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                Cognitive Complexity

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

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

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

                                Further reading

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

                                    def on_post(req, resp, id_):
                                        """Handles POST requests"""
                                        admin_control(req)
                                        try:
                                            raw_json = req.stream.read().decode('utf-8')
                                Severity: Minor
                                Found in myems-api/core/energystoragecontainer.py - About 35 mins to fix

                                Cognitive Complexity

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

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

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

                                Further reading

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

                                    def on_delete(req, resp, id_, sid):
                                        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_ENERGY_STORAGE_CONTAINER_ID')
                                Severity: Minor
                                Found in myems-api/core/energystoragecontainer.py - About 25 mins to fix

                                Cognitive Complexity

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

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

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

                                Further reading

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

                                class EnergyStorageContainerPowerconversionsystemItem:
                                    @staticmethod
                                    def __init__():
                                        """Initializes Class"""
                                        pass
                                Severity: Major
                                Found in myems-api/core/energystoragecontainer.py and 1 other location - About 2 mos to fix
                                myems-api/core/microgrid.py on lines 4451..4998

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

                                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

                                class EnergyStorageContainerPowerconversionsystemCollection:
                                    @staticmethod
                                    def __init__():
                                        """Initializes Class"""
                                        pass
                                Severity: Major
                                Found in myems-api/core/energystoragecontainer.py and 1 other location - About 1 mo to fix
                                myems-api/core/microgrid.py on lines 3967..4448

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

                                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

                                class EnergyStorageContainerBatteryItem:
                                    @staticmethod
                                    def __init__():
                                        """Initializes Class"""
                                        pass
                                Severity: Major
                                Found in myems-api/core/energystoragecontainer.py and 1 other location - About 1 mo to fix
                                myems-api/core/microgrid.py on lines 839..1164

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

                                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

                                class EnergyStorageContainerBatteryCollection:
                                    @staticmethod
                                    def __init__():
                                        """Initializes Class"""
                                        pass
                                Severity: Major
                                Found in myems-api/core/energystoragecontainer.py and 1 other location - About 3 wks to fix
                                myems-api/core/microgrid.py on lines 578..836

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

                                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

                                class EnergyStorageContainerGridItem:
                                    @staticmethod
                                    def __init__():
                                        """Initializes Class"""
                                        pass
                                Severity: Major
                                Found in myems-api/core/energystoragecontainer.py and 1 other location - About 3 wks to fix
                                myems-api/core/microgrid.py on lines 2301..2566

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

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

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

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

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

                                Refactorings

                                Further Reading

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

                                class EnergyStorageContainerLoadItem:
                                    @staticmethod
                                    def __init__():
                                        """Initializes Class"""
                                        pass
                                Severity: Major
                                Found in myems-api/core/energystoragecontainer.py and 2 other locations - About 2 wks to fix
                                myems-api/core/microgrid.py on lines 1405..1648
                                myems-api/core/microgrid.py on lines 1843..2087

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

                                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

                                class EnergyStorageContainerGridCollection:
                                    @staticmethod
                                    def __init__():
                                        """Initializes Class"""
                                        pass
                                Severity: Major
                                Found in myems-api/core/energystoragecontainer.py and 1 other location - About 2 wks to fix
                                myems-api/core/microgrid.py on lines 2090..2298

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

                                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

                                class EnergyStorageContainerLoadCollection:
                                    @staticmethod
                                    def __init__():
                                        """Initializes Class"""
                                        pass
                                Severity: Major
                                Found in myems-api/core/energystoragecontainer.py and 1 other location - About 2 wks to fix
                                myems-api/core/microgrid.py on lines 1651..1840

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

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

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

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

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

                                Refactorings

                                Further Reading

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

                                class EnergyStorageContainerSensorCollection:
                                    @staticmethod
                                    def __init__():
                                        """Initializes Class"""
                                        pass
                                Severity: Major
                                Found in myems-api/core/energystoragecontainer.py and 2 other locations - About 1 wk to fix
                                myems-api/core/energystoragepowerstation.py on lines 546..658
                                myems-api/core/microgrid.py on lines 5001..5109

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

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

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

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

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

                                Refactorings

                                Further Reading

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

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

                                Duplicated Code

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

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

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

                                Tuning

                                This issue has a mass of 388.

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

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

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

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

                                Refactorings

                                Further Reading

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

                                class EnergyStorageContainerCommandCollection:
                                    @staticmethod
                                    def __init__():
                                        """Initializes Class"""
                                        pass
                                Severity: Major
                                Found in myems-api/core/energystoragecontainer.py and 1 other location - About 2 days to fix
                                myems-api/core/microgrid.py on lines 1167..1209

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

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

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

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

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

                                Refactorings

                                Further Reading

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

                                                meta_result = {"id": row[0],
                                                               "name": row[1],
                                                               "uuid": row[2],
                                                               "rated_capacity": row[3],
                                                               "rated_power": row[4],
                                Severity: Major
                                Found in myems-api/core/energystoragecontainer.py and 1 other location - About 6 hrs to fix
                                myems-api/core/energystoragecontainer.py on lines 246..259

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

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

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

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

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

                                Refactorings

                                Further Reading

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

                                        if row is None:
                                            raise falcon.HTTPError(status=falcon.HTTP_404, title='API.NOT_FOUND',
                                                                   description='API.ENERGY_STORAGE_CONTAINER_NOT_FOUND')
                                        else:
                                            meta_result = {"id": row[0],
                                Severity: Major
                                Found in myems-api/core/energystoragecontainer.py and 1 other location - About 6 hrs to fix
                                myems-api/core/energystoragecontainer.py on lines 58..67

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

                                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