mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed following SonarQube issues:
- Remove this assignment to the local variable, the value is never used. - Rename local variables to match the regular expression - Add logic to this except clause or eliminate it and rethrow the exception automatically. - Rename fields to match the regular expression - Extract this nested conditional expression into an independent statement. - Change this default value to "None" and initialize this parameter inside the function/method. - Update this function so that its implementation is not identical to __repr__ - Refactor this method to not always return the same value - Reraise this exception to stop the application as the user expects - Add missing parameters _w _PY3. This method overrides simplejson.decoder.JSONDecoder.decode. - Remove this redundant continue. - Remove this unused function declaration - Remove this identity check; it will always be False.
This commit is contained in:
committed by
Akshay Joshi
parent
eb2c554601
commit
536593bf8a
@@ -1016,9 +1016,11 @@ class ServerNode(PGChildNodeView):
|
||||
else:
|
||||
return unauthorized(gettext("Unauthorized request."))
|
||||
|
||||
data = request.form if request.form else json.loads(
|
||||
request.data, encoding='utf-8'
|
||||
) if request.data else {}
|
||||
data = {}
|
||||
if request.form:
|
||||
data = request.form
|
||||
elif request.data:
|
||||
data = json.loads(request.data, encoding='utf-8')
|
||||
|
||||
password = None
|
||||
passfile = None
|
||||
|
||||
@@ -862,8 +862,6 @@ class DatabaseView(PGChildNodeView):
|
||||
)
|
||||
else:
|
||||
|
||||
status = self.manager.release(did=did)
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
datname=res, conn=self.conn
|
||||
|
||||
@@ -305,9 +305,12 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
|
||||
data[key] = []
|
||||
|
||||
elif key == 'typnotnull':
|
||||
data[key] = True if (req[key] == 'true' or req[key]
|
||||
is True) else False if \
|
||||
(req[key] == 'false' or req[key]) is False else ''
|
||||
if req[key] == 'true' or req[key] is True:
|
||||
data[key] = True
|
||||
elif req[key] == 'false' or req[key] is False:
|
||||
data[key] = False
|
||||
else:
|
||||
data[key] = ''
|
||||
else:
|
||||
data[key] = req[key]
|
||||
|
||||
|
||||
@@ -450,7 +450,7 @@ class PartitionsView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
)
|
||||
res[row['name']] = data
|
||||
|
||||
return res
|
||||
return res
|
||||
|
||||
@BaseTableView.check_precondition
|
||||
def sql(self, gid, sid, did, scid, tid, ptid):
|
||||
|
||||
@@ -473,15 +473,15 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
|
||||
# If we have length & precision both
|
||||
if is_tlength and is_precision:
|
||||
matchObj = re.search(r'(\d+),(\d+)', row['fulltype'])
|
||||
if matchObj:
|
||||
t_len = matchObj.group(1)
|
||||
t_prec = matchObj.group(2)
|
||||
match_obj = re.search(r'(\d+),(\d+)', row['fulltype'])
|
||||
if match_obj:
|
||||
t_len = match_obj.group(1)
|
||||
t_prec = match_obj.group(2)
|
||||
elif is_tlength:
|
||||
# If we have length only
|
||||
matchObj = re.search(r'(\d+)', row['fulltype'])
|
||||
if matchObj:
|
||||
t_len = matchObj.group(1)
|
||||
match_obj = re.search(r'(\d+)', row['fulltype'])
|
||||
if match_obj:
|
||||
t_len = match_obj.group(1)
|
||||
t_prec = None
|
||||
|
||||
type_name = DataTypeReader.parse_type_name(row['typname'])
|
||||
|
||||
Reference in New Issue
Block a user