Fix following issues reported by SonarQube:

1) Properties of variables with "null" or "undefined" values should not be accessed
2) Variables should not be self-assigned
3) "in" should not be used with primitive types
This commit is contained in:
Khushboo Vashi
2020-06-15 16:16:57 +05:30
committed by Akshay Joshi
parent 641f7bbe9d
commit 8ab358ccec
6 changed files with 9 additions and 9 deletions

View File

@@ -249,7 +249,7 @@ define('pgadmin.node.rule', [
prev_e = prev_j ? t.itemData(prev_j) : null,
prev_k = t.hasParent(prev_j) ? t.parent(prev_j) : null,
prev_f = prev_k ? t.itemData(prev_k) : null;
if( prev_f._type == 'catalog') {
if(!_.isNull(prev_f) && prev_f._type == 'catalog') {
return false;
} else {
return true;
@@ -264,7 +264,7 @@ define('pgadmin.node.rule', [
prev_i = t.hasParent(i) ? t.parent(i) : null;
prev_j = t.hasParent(prev_i) ? t.parent(prev_i) : null;
prev_e = prev_j ? t.itemData(prev_j) : null;
if(prev_e._type == 'schema') {
if(!_.isNull(prev_e) && prev_e._type == 'schema') {
return true;
}else{
return false;

View File

@@ -389,7 +389,7 @@ define('pgadmin.node.mview', [
i = item || t.selected(),
d = data || (i && i.length == 1 ? t.itemData(i): undefined),
node = this || (d && pgAdmin.Browser.Nodes[d._type]),
info = node.getTreeNodeHierarchy.apply(node, [i]),
info = node && node.getTreeNodeHierarchy.apply(node, [i]),
version = info.server.version;
// disable refresh concurrently if server version is 9.3

View File

@@ -44,7 +44,7 @@ function(gettext, _, $, Backbone, Backform, Backgrid, Alertify, pgAdmin, pgNode)
case 'enum':
model.set({'value': value}, {silent:true});
var options = [],
enumVals = variable.enumvals;
enumVals = variable && variable.enumvals;
_.each(enumVals, function(enumVal) {
options.push([enumVal, enumVal]);