From 3f7e921cce63ba52eba8477f419eab87fb7bb889 Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Wed, 12 Jan 2022 18:59:21 +0530 Subject: [PATCH] =?UTF-8?q?Fixed=20code=20smell=20'Unexpected=20empty=20ar?= =?UTF-8?q?row=20function'=20reported=C2=A0by=20SonarQube.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tables/partitions/static/js/partition.js | 4 ++-- .../databases/schemas/tables/static/js/table.js | 4 ++-- .../server_groups/servers/static/js/server.js | 2 +- web/pgadmin/browser/static/js/browser.js | 8 ++++---- web/pgadmin/browser/static/js/collection.js | 2 +- web/pgadmin/browser/static/js/node.js | 2 +- web/pgadmin/browser/static/js/wizard.js | 4 ++-- web/pgadmin/misc/file_manager/static/js/utility.js | 4 ++-- .../misc/statistics/static/js/statistics.js | 2 +- web/pgadmin/static/js/backform.pgadmin.js | 8 ++++---- web/pgadmin/static/js/backgrid.pgadmin.js | 14 +++++++------- web/pgadmin/static/vendor/backform/backform.js | 4 ++-- web/pgadmin/static/vendor/require/require.js | 2 +- .../tools/debugger/static/js/debugger_ui.js | 6 +++--- web/pgadmin/tools/debugger/static/js/direct.js | 4 ++-- .../tools/schema_diff/static/js/schema_diff_ui.js | 2 +- web/regression/javascript/erd/erd_core_spec.js | 4 ++-- .../javascript/file_manager/file_manager_specs.js | 6 +++--- 18 files changed, 41 insertions(+), 41 deletions(-) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js index 8e3a1ada3..6faa20ba7 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition.js @@ -269,7 +269,7 @@ function( }); } }, - function() {} + function() {/*This is intentional (SonarQube)*/} ); }, detach_partition: function(args) { @@ -312,7 +312,7 @@ function( }); } }, - function() {} + function() {/*This is intentional (SonarQube)*/} ); }, }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js index 79632f3d7..2e745acbc 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js @@ -213,7 +213,7 @@ define('pgadmin.node.table', [ Notify.pgRespErrorNotify(xhr, error); t.unload(i); }); - }, function() {} + }, function() {/*This is intentional (SonarQube)*/} ); }, reset_table_stats: function(args) { @@ -255,7 +255,7 @@ define('pgadmin.node.table', [ t.unload(i); }); }, - function() {} + function() {/*This is intentional (SonarQube)*/} ); }, count_table_rows: function(args) { diff --git a/web/pgadmin/browser/server_groups/servers/static/js/server.js b/web/pgadmin/browser/server_groups/servers/static/js/server.js index 6b5b2817e..3fc98cba2 100644 --- a/web/pgadmin/browser/server_groups/servers/static/js/server.js +++ b/web/pgadmin/browser/server_groups/servers/static/js/server.js @@ -969,7 +969,7 @@ define('pgadmin.node.server', [ }, }; }, - build:function() {}, + build:function() {/*This is intentional (SonarQube)*/}, prepare:function() { this.setContent(this.message); }, diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js index dcc11c098..bf5fcdfe1 100644 --- a/web/pgadmin/browser/static/js/browser.js +++ b/web/pgadmin/browser/static/js/browser.js @@ -393,7 +393,7 @@ define('pgadmin.browser', [ $el: $('
  • ' + gettext('No object selected') + '
  • '), priority: 1, category: 'create', - update: function() {}, + update: function() {/*This is intentional (SonarQube)*/}, }], false); $obj_mnu.append(create_submenu.$el); } @@ -518,8 +518,8 @@ define('pgadmin.browser', [ type:'POST', headers: headers, }) - .done(function() {}) - .fail(function() {}); + .done(function() {/*This is intentional (SonarQube)*/}) + .fail(function() {/*This is intentional (SonarQube)*/}); }, 300000); obj.set_master_password(''); @@ -556,7 +556,7 @@ define('pgadmin.browser', [ 'the original/corrupt file using a tool such as DB Browser for SQLite if desired.'+ '

    Original file: ' + res.data + '
    Replacement file: ' + res.data.substring(0, res.data.length - 14), - function() { + function() { /*This is intentional (SonarQube)*/ } ); } diff --git a/web/pgadmin/browser/static/js/collection.js b/web/pgadmin/browser/static/js/collection.js index 149b33ec1..598e675b6 100644 --- a/web/pgadmin/browser/static/js/collection.js +++ b/web/pgadmin/browser/static/js/collection.js @@ -24,7 +24,7 @@ define([ if (pgBrowser.Collection) return pgBrowser.Collection; - pgBrowser.Collection = function() {}; + pgBrowser.Collection = function() {/*This is intentional (SonarQube)*/}; _.extend( pgBrowser.Collection, diff --git a/web/pgadmin/browser/static/js/node.js b/web/pgadmin/browser/static/js/node.js index 1051c6b5d..80870469e 100644 --- a/web/pgadmin/browser/static/js/node.js +++ b/web/pgadmin/browser/static/js/node.js @@ -40,7 +40,7 @@ define('pgadmin.browser.node', [ // A helper (base) class for all the nodes, this has basic // operations/callbacks defined for basic operation. - pgBrowser.Node = function() {}; + pgBrowser.Node = function() {/*This is intentional (SonarQube)*/}; // Helper function to correctly set up the property chain, for subclasses. // Uses a hash of class properties to be extended. diff --git a/web/pgadmin/browser/static/js/wizard.js b/web/pgadmin/browser/static/js/wizard.js index 60540dc6f..c91587cbc 100644 --- a/web/pgadmin/browser/static/js/wizard.js +++ b/web/pgadmin/browser/static/js/wizard.js @@ -40,8 +40,8 @@ define([ beforeNext: function() { return true; }, - onNext: function() {}, - onBefore: function() {}, + onNext: function() {/*This is intentional (SonarQube)*/}, + onBefore: function() {/*This is intentional (SonarQube)*/}, /* Callback for before Previous */ beforePrev: function() { return true; diff --git a/web/pgadmin/misc/file_manager/static/js/utility.js b/web/pgadmin/misc/file_manager/static/js/utility.js index eb0f9f695..5e28fcad5 100644 --- a/web/pgadmin/misc/file_manager/static/js/utility.js +++ b/web/pgadmin/misc/file_manager/static/js/utility.js @@ -1765,7 +1765,7 @@ define([ formData.append('mode', 'add'); formData.append('currentpath', path); $('.upload_file .dz_cross_btn').attr('disabled', 'disabled'); - setTimeout(function() {}, 10000); + setTimeout(function() {/*This is intentional (SonarQube)*/}, 10000); }, success: function(file, response) { var resp_data = response.data.result, @@ -1784,7 +1784,7 @@ define([ } getFolderInfo(path); }, - totaluploadprogress: function() {}, + totaluploadprogress: function() {/*This is intentional (SonarQube)*/}, complete: function(file) { if (file.status == 'error') { Notify.error(lg.upload_error); diff --git a/web/pgadmin/misc/statistics/static/js/statistics.js b/web/pgadmin/misc/statistics/static/js/statistics.js index a32d7f4e6..afe34a10a 100644 --- a/web/pgadmin/misc/statistics/static/js/statistics.js +++ b/web/pgadmin/misc/statistics/static/js/statistics.js @@ -27,7 +27,7 @@ define('misc.statistics', [ return pgBrowser.NodeStatistics; } - var SizeFormatter = Backgrid.SizeFormatter = function() {}; + var SizeFormatter = Backgrid.SizeFormatter = function() {/*This is intentional (SonarQube)*/}; _.extend(SizeFormatter.prototype, { /** Takes a raw value from a model and returns the human readable formatted diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js index 0ae392cb2..8d8d13814 100644 --- a/web/pgadmin/static/js/backform.pgadmin.js +++ b/web/pgadmin/static/js/backform.pgadmin.js @@ -100,7 +100,7 @@ define([ }; /* Returns raw data as it is */ - var RawFormatter = Backform.RawFormatter = function() {}; + var RawFormatter = Backform.RawFormatter = function() {/*This is intentional (SonarQube)*/}; _.extend(RawFormatter.prototype, { fromRaw: function(rawData) { return rawData; @@ -2204,7 +2204,7 @@ define([ return fields; }; - var Select2Formatter = function() {}; + var Select2Formatter = function() {/*This is intentional (SonarQube)*/}; _.extend(Select2Formatter.prototype, { fromRaw: function(rawData) { return encodeURIComponent(rawData); @@ -2492,7 +2492,7 @@ define([ } return this; }, - formatter: function() {}, + formatter: function() {/*This is intentional (SonarQube)*/}, cleanup: function() { Backform.Fieldset.prototype.cleanup.apply(this); }, @@ -3352,7 +3352,7 @@ define([ }, }); - var KeyCodeControlFormatter = Backform.KeyCodeControlFormatter = function() {}; + var KeyCodeControlFormatter = Backform.KeyCodeControlFormatter = function() {/*This is intentional (SonarQube)*/}; _.extend(KeyCodeControlFormatter.prototype, { fromRaw: function (rawData) { diff --git a/web/pgadmin/static/js/backgrid.pgadmin.js b/web/pgadmin/static/js/backgrid.pgadmin.js index 91e2c4cd9..4e69f95dd 100644 --- a/web/pgadmin/static/js/backgrid.pgadmin.js +++ b/web/pgadmin/static/js/backgrid.pgadmin.js @@ -1340,7 +1340,7 @@ define([ * displayed in the cell. */ var InputStringArrayCellFormatter = Backgrid.Extension.InputStringArrayCellFormatter = - function() {}; + function() {/*This is intentional (SonarQube)*/}; _.extend(InputStringArrayCellFormatter.prototype, { /** * Takes a raw value from a model and returns an optionally formatted @@ -1368,7 +1368,7 @@ define([ * displayed in the cell. */ var InputIntegerArrayCellFormatter = Backgrid.Extension.InputIntegerArrayCellFormatter = - function() {}; + function() {/*This is intentional (SonarQube)*/}; _.extend(InputIntegerArrayCellFormatter.prototype, { /** * Takes a raw value from a model and returns an optionally formatted @@ -1402,7 +1402,7 @@ define([ * displayed in the cell. */ var InputNumberArrayCellFormatter= Backgrid.Extension.InputNumberArrayCellFormatter = - function() {}; + function() {/*This is intentional (SonarQube)*/}; _.extend(InputNumberArrayCellFormatter.prototype, { /** * Takes a raw value from a model and returns an optionally formatted @@ -1542,7 +1542,7 @@ define([ * * @class Backgrid.Extension.DependentCell **/ - var DependentCell = Backgrid.Extension.DependentCell = function() {}; + var DependentCell = Backgrid.Extension.DependentCell = function() {/*This is intentional (SonarQube)*/}; _.extend( DependentCell.prototype, { @@ -1582,7 +1582,7 @@ define([ @extends Backgrid.CellFormatter @constructor */ - var PasswordFormatter = Backgrid.PasswordFormatter = function() {}; + var PasswordFormatter = Backgrid.PasswordFormatter = function() {/*This is intentional (SonarQube)*/}; PasswordFormatter.prototype = new Backgrid.CellFormatter(); _.extend(PasswordFormatter.prototype, { fromRaw: function(rawValue) { @@ -1639,7 +1639,7 @@ define([ * JSONBCell Formatter. */ var JSONBCellFormatter = Backgrid.Extension.JSONBCellFormatter = - function() {}; + function() {/*This is intentional (SonarQube)*/}; _.extend(JSONBCellFormatter.prototype, { fromRaw: function(rawData) { // json data @@ -2104,7 +2104,7 @@ define([ }, }); - var BooleanCellFormatter = Backgrid.BooleanCellFormatter = function() {}; + var BooleanCellFormatter = Backgrid.BooleanCellFormatter = function() {/*This is intentional (SonarQube)*/}; _.extend(BooleanCellFormatter.prototype, { fromRaw: function (rawValue) { if (_.isUndefined(rawValue) || _.isNull(rawValue)) { diff --git a/web/pgadmin/static/vendor/backform/backform.js b/web/pgadmin/static/vendor/backform/backform.js index fa5630f13..ea7b69579 100644 --- a/web/pgadmin/static/vendor/backform/backform.js +++ b/web/pgadmin/static/vendor/backform/backform.js @@ -131,7 +131,7 @@ @class Backform.ControlFormatter @constructor */ - var ControlFormatter = Backform.ControlFormatter = function() {}; + var ControlFormatter = Backform.ControlFormatter = function() {/*This is intentional (SonarQube)*/}; _.extend(ControlFormatter.prototype, { /** @@ -167,7 +167,7 @@ }); // Store value in DOM as stringified JSON. - var JSONFormatter = Backform.JSONFormatter = function() {}; + var JSONFormatter = Backform.JSONFormatter = function() {/*This is intentional (SonarQube)*/}; _.extend(JSONFormatter.prototype, { fromRaw: function(rawData, model) { return JSON.stringify(rawData); diff --git a/web/pgadmin/static/vendor/require/require.js b/web/pgadmin/static/vendor/require/require.js index 78490f91d..2d34ba794 100644 --- a/web/pgadmin/static/vendor/require/require.js +++ b/web/pgadmin/static/vendor/require/require.js @@ -1975,7 +1975,7 @@ var requirejs, require, define; // Post a task to the event loop to work around a bug in WebKit // where the worker gets garbage-collected after calling // importScripts(): https://webkit.org/b/153317 - setTimeout(function() {}, 0); + setTimeout(function() {/*This is intentional (SonarQube)*/}, 0); importScripts(url); //Account for anonymous modules diff --git a/web/pgadmin/tools/debugger/static/js/debugger_ui.js b/web/pgadmin/tools/debugger/static/js/debugger_ui.js index 111ff6033..e33f9ab0b 100644 --- a/web/pgadmin/tools/debugger/static/js/debugger_ui.js +++ b/web/pgadmin/tools/debugger/static/js/debugger_ui.js @@ -856,7 +856,7 @@ define([ 'data': JSON.stringify(sqlite_func_args_list), }, }) - .done(function() {}) + .done(function() {/*This is intentional (SonarQube)*/}) .fail(function() { Notify.alert( gettext('Debugger Error'), @@ -884,7 +884,7 @@ define([ 'data': JSON.stringify(args_value_list), }, }) - .done(function() {}) + .done(function() {/*This is intentional (SonarQube)*/}) .fail(function(er) { Notify.alert( gettext('Debugger Listener Startup Error'), @@ -906,7 +906,7 @@ define([ 'data': JSON.stringify(sqlite_func_args_list), }, }) - .done(function() {}) + .done(function() {/*This is intentional (SonarQube)*/}) .fail(function() { Notify.alert( gettext('Debugger Error'), diff --git a/web/pgadmin/tools/debugger/static/js/direct.js b/web/pgadmin/tools/debugger/static/js/direct.js index 1a81e715a..1e9e35d32 100644 --- a/web/pgadmin/tools/debugger/static/js/direct.js +++ b/web/pgadmin/tools/debugger/static/js/direct.js @@ -33,7 +33,7 @@ define([ if (pgTools.DirectDebug) return pgTools.DirectDebug; - var controller = new(function() {}); + var controller = new(function() {/*This is intentional (SonarQube)*/}); _.extend( controller, Backbone.Events, { @@ -1491,7 +1491,7 @@ define([ Function is responsible to create the new wcDocker instance for debugger and initialize the debugger panel inside the docker instance. */ - var DirectDebug = function() {}; + var DirectDebug = function() {/*This is intentional (SonarQube)*/}; _.extend(DirectDebug.prototype, { /* We should get the transaction id from the server during initialization here */ diff --git a/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js b/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js index 0f774fa0a..ed99e56c7 100644 --- a/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js +++ b/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js @@ -939,7 +939,7 @@ export default class SchemaDiffUI { }, }; }, - build:function() {}, + build:function() {/*This is intentional (SonarQube)*/}, prepare:function() { this.setContent(this.message); }, diff --git a/web/regression/javascript/erd/erd_core_spec.js b/web/regression/javascript/erd/erd_core_spec.js index 0f205b4d4..b3a598440 100644 --- a/web/regression/javascript/erd/erd_core_spec.js +++ b/web/regression/javascript/erd/erd_core_spec.js @@ -256,8 +256,8 @@ describe('ERDCore', ()=>{ spyOn(erdCoreObj, 'getNewLink').and.callFake(function() { return { - setSourcePort: function() {}, - setTargetPort: function() {}, + setSourcePort: function() {/*This is intentional (SonarQube)*/}, + setTargetPort: function() {/*This is intentional (SonarQube)*/}, }; }); spyOn(erdCoreObj, 'getNewPort').and.returnValue({id: 'id'}); diff --git a/web/regression/javascript/file_manager/file_manager_specs.js b/web/regression/javascript/file_manager/file_manager_specs.js index ac7205c15..493e7be7d 100644 --- a/web/regression/javascript/file_manager/file_manager_specs.js +++ b/web/regression/javascript/file_manager/file_manager_specs.js @@ -124,7 +124,7 @@ describe('fileSelectDialog', function () { }; spyOn(Alertify, 'fileSelectionDlg').and.callFake(function() { - this.resizeTo = function() {}; + this.resizeTo = function() {/*This is intentional (SonarQube)*/}; return this; }); @@ -140,7 +140,7 @@ describe('fileSelectDialog', function () { }; spyOn(Alertify, 'createModeDlg').and.callFake(function() { - this.resizeTo = function() {}; + this.resizeTo = function() {/*This is intentional (SonarQube)*/}; return this; }); @@ -208,7 +208,7 @@ describe('fileSelectDialog', function () { }; spyOn(Alertify, 'fileStorageDlg').and.callFake(function() { - this.resizeTo = function() {}; + this.resizeTo = function() {/*This is intentional (SonarQube)*/}; return this; });