Showing 5,781 of 10,536 total issues

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

    def on_post(req, resp, id_):
        """Handles POST requests"""
        admin_control(req)
        if not id_.isdigit() or int(id_) <= 0:
            raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
Severity: Minor
Found in myems-api/core/meter.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):
            access_control(req)
            cnx = mysql.connector.connect(**config.myems_system_db)
            cursor = cnx.cursor()
    
    
    Severity: Minor
    Found in myems-api/core/photovoltaicpowerstation.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_):
              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_):
                """Handles GET requests"""
                access_control(req)
                if not id_.isdigit() or int(id_) <= 0:
                    raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
        Severity: Minor
        Found in myems-api/core/webmessage.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_):
                  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_PHOTOVOLTAIC_POWER_STATION_ID')
          Severity: Minor
          Found in myems-api/core/photovoltaicpowerstation.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_):
                    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 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def on_put(req, resp, id_, sid):
                      """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 26 lines of code (exceeds 25 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_PHOTOVOLTAIC_POWER_STATION_ID')
                Severity: Minor
                Found in myems-api/core/photovoltaicpowerstation.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 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def on_get(req, resp):
                            if 'API-KEY' not in req.headers or \
                                    not isinstance(req.headers['API-KEY'], str) or \
                                    len(str.strip(req.headers['API-KEY'])) == 0:
                                access_control(req)
                    Severity: Minor
                    Found in myems-api/core/offlinemeter.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_):
                              if 'API-KEY' not in req.headers or \
                                      not isinstance(req.headers['API-KEY'], str) or \
                                      len(str.strip(req.headers['API-KEY'])) == 0:
                                  access_control(req)
                      Severity: Minor
                      Found in myems-api/core/offlinemeter.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_):
                                if 'API-KEY' not in req.headers or \
                                        not isinstance(req.headers['API-KEY'], str) or \
                                        len(str.strip(req.headers['API-KEY'])) == 0:
                                    access_control(req)
                        Severity: Minor
                        Found in myems-api/core/offlinemeter.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_):
                                  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_POWER_STATION_ID')
                          Severity: Minor
                          Found in myems-api/core/energystoragepowerstation.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_):
                                    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_POWER_STATION_ID')
                            Severity: Minor
                            Found in myems-api/core/energystoragepowerstation.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_):
                                      if 'API-KEY' not in req.headers or \
                                              not isinstance(req.headers['API-KEY'], str) or \
                                              len(str.strip(req.headers['API-KEY'])) == 0:
                                          access_control(req)
                              Severity: Minor
                              Found in myems-api/core/tenant.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_):
                                        if 'API-KEY' not in req.headers or \
                                                not isinstance(req.headers['API-KEY'], str) or \
                                                len(str.strip(req.headers['API-KEY'])) == 0:
                                            access_control(req)
                                Severity: Minor
                                Found in myems-api/core/tenant.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):
                                          access_control(req)
                                          cnx = mysql.connector.connect(**config.myems_system_db)
                                          cursor = cnx.cursor()
                                  
                                  
                                  Severity: Minor
                                  Found in myems-api/core/energystoragepowerstation.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_, hid):
                                            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_MICROGRID_ID')
                                    Severity: Minor
                                    Found in myems-api/core/microgrid.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_, 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_MICROGRID_ID')
                                      Severity: Minor
                                      Found in myems-api/core/microgrid.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_, 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_MICROGRID_ID')
                                        Severity: Minor
                                        Found in myems-api/core/microgrid.py - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language