Fixed 'Comma operator should not be used' issue reported by SonarQube.

This commit is contained in:
Yogesh Mahajan 2020-06-18 16:17:55 +05:30 committed by Akshay Joshi
parent 905be1d894
commit 6d3f13076f
10 changed files with 44 additions and 18 deletions

View File

@ -479,7 +479,7 @@ define(['sources/gettext', 'underscore', 'jquery', 'backbone', 'backform',
* 3. Deselect and disable the checkbox for ALL with grant privilege.
*/
$allPrivileges.prop('checked', false);
$elGrant.prop('checked', false),
$elGrant.prop('checked', false);
$allGrants.prop('checked', false);
$elGrant.prop('disabled', true);
$allGrants.prop('disabled', true);

View File

@ -162,7 +162,7 @@ define([
self.origSessAttrs = {};
self.objects = [];
self.arrays = [];
self.attrName = options.attrName,
self.attrName = options.attrName;
self.top = (options.top || self.collection && self.collection.top || self.collection || self);
self.handler = options.handler ||
(self.collection && self.collection.handler);

View File

@ -631,7 +631,7 @@ define('pgadmin.browser.node', [
}
}
x = (b.offsetWidth - w) / 2,
x = (b.offsetWidth - w) / 2;
y = (b.offsetHeight - h) / 4;
var p = pgBrowser.docker.addPanel(

View File

@ -58,7 +58,7 @@ define('pgadmin.dashboard', [
if (e.keyCode == 32) {
self.$el.click();
}
}),
});
this.delegateEvents();
return this;
},

View File

@ -841,7 +841,7 @@ define([
$this = $('.fileinfo').find(
'table#contents tbody tr.selected td.tbl_file'
);
orig_value = decodeURI($this.find('span.less_text').html()),
orig_value = decodeURI($this.find('span.less_text').html());
newvalue = orig_value.substring(0, orig_value.lastIndexOf('.'));
if (orig_value.lastIndexOf('/') == orig_value.length - 1 || newvalue === '') {

View File

@ -147,7 +147,11 @@ define([
}
// if descending order, swap left and right
if (order === 1) t = _l, _l = _r, _r = t;
if (order === 1) {
t = _l;
_l = _r;
_r = t;
}
if (_l.eq(_r)) // If both are equals
return 0;
@ -157,7 +161,11 @@ define([
return 1;
} else {
// if descending order, swap left and right
if (order === 1) t = l, l = r, r = t;
if (order === 1) {
t = l;
l = r;
r = t;
}
// compare as usual
if (l === r) return 0;

View File

@ -21,15 +21,21 @@ define([], function() {
var n, l, m, c = (e.match(s) || [])[2],
f = 'px' === c ? 1 : d[c + 'toPx'],
u = /r?em/i;
if (f || u.test(c) && !p) t = f ? t : 'rem' === c ? i : 'fontSize' === r ? t.parentNode || t : t, f = f || parseFloat(a(t, 'fontSize')), m = parseFloat(e) * f;
if (f || u.test(c) && !p){
t = f ? t : 'rem' === c ? i : 'fontSize' === r ? t.parentNode || t : t;
f = f || parseFloat(a(t, 'fontSize'));
m = parseFloat(e) * f;
}
else {
n = t.style, l = n[r];
n = t.style;
l = n[r];
try {
n[r] = e;
} catch (x) {
return 0;
}
m = n[r] ? parseFloat(a(t, r)) : 0, n[r] = l !== o ? l : null;
m = n[r] ? parseFloat(a(t, r)) : 0;
n[r] = l !== o ? l : null;
}
return m;
}
@ -61,7 +67,7 @@ define([], function() {
f = ['mm', 'cm', 'pt', 'pc', 'in', 'mozmm'],
u = 6;
for (i.appendChild(n), m && (n.style.marginTop = '1%', p = '1%' === m(n).marginTop); u--;) d[f[u] + 'toPx'] = c[u] ? c[u] * d.inToPx : r(n, '1' + f[u]);
i.removeChild(n), n = o, t.toPx = r;
i.removeChild(n); t.toPx = r;
})(pgAdmin, window.document);
// Reference:

View File

@ -339,7 +339,7 @@ var PercentFormatter = Backgrid.PercentFormatter = function () {
Backgrid.NumberFormatter.apply(this, arguments);
};
PercentFormatter.prototype = new Backgrid.NumberFormatter(),
PercentFormatter.prototype = new Backgrid.NumberFormatter();
_.extend(PercentFormatter.prototype, {
@ -2656,7 +2656,11 @@ var Body = Backgrid.Body = Backbone.View.extend({
var l = func(left, attr), r = func(right, attr), t;
// if descending order, swap left and right
if (order === 1) t = l, l = r, r = t;
if (order === 1) {
t = l;
l = r;
r = t;
}
// compare as usual
if (l === r) return 0;

View File

@ -33,7 +33,7 @@ export default class SchemaDiffUI {
this.filters = ['Identical', 'Different', 'Source Only', 'Target Only'];
this.sel_filters = ['Different', 'Source Only', 'Target Only'];
this.dataView = null;
this.grid = null,
this.grid = null;
this.selection = {};
this.model = new Backbone.Model({

View File

@ -567,19 +567,27 @@ describe('the keyboard shortcuts', () => {
});
it('shortcut_title',()=>{
shortcut.alt = true, shortcut.shift = false, shortcut.control = false;
shortcut.alt = true;
shortcut.shift = false;
shortcut.control = false;
expect(keyboardShortcuts.shortcut_title(
'Title', shortcut)).toEqual(gettext('Title (Alt+A)'));
shortcut.alt = false, shortcut.shift = true, shortcut.control = false;
shortcut.alt = false;
shortcut.shift = true;
shortcut.control = false;
expect(keyboardShortcuts.shortcut_title(
'Title', shortcut)).toEqual(gettext('Title (Shift+A)'));
shortcut.alt = false, shortcut.shift = false, shortcut.control = true;
shortcut.alt = false;
shortcut.shift = false;
shortcut.control = true;
expect(keyboardShortcuts.shortcut_title(
'Title', shortcut)).toEqual(gettext('Title (Ctrl+A)'));
shortcut.alt = true, shortcut.shift = true, shortcut.control = true;
shortcut.alt = true;
shortcut.shift = true;
shortcut.control = true;
expect(keyboardShortcuts.shortcut_title(
'Title', shortcut)).toEqual(gettext('Title (Alt+Shift+Ctrl+A)'));
});