public inbox for [email protected]  
help / color / mirror / Atom feed
From: Pradip Parkale <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin]:Patch for SonarQube fixes.
Date: Thu, 18 Mar 2021 14:51:27 +0530
Message-ID: <CAJ9T6StbjNif0Gi8_=hv_3GixnPr4zqJDFbHgL83eV0osHNxow@mail.gmail.com> (raw)

Hi Hackers,

I have fixed a few sonarQube issues.PFA patch.

   - Fts Configuration


   1. Remove this commented-out code.


   - Funtion


   1. Update this function so that its implementation is not identical to
   the one on line 51.
   2. Unexpected empty method 'validate'.


   - Trigger function


   1. Update this function so that its implementation is not identical to
   the one on line 41.


   - Exclusion constraint


   1. Update this function so that its implementation is not identical to
   the one on line 128.


   - File manager


   1. Remove the unused local variable "e".


-- 
Thanks & Regards,
Pradip Parkale
Software Engineer | EnterpriseDB Corporation


Attachments:

  [application/octet-stream] sonarqube.patch (4.5K, 3-sonarqube.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration.js
index fefe309b1..b9b24fee4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration.js
@@ -367,7 +367,6 @@ define('pgadmin.node.fts_configuration', [
           self.$grid.find('.new').removeClass('new');
           var newRow = self.grid.body.rows[idx].$el;
           newRow.addClass('new');
-          //$(newRow).pgMakeVisible('table-bordered');
           $(newRow).pgMakeVisible('backform-tab');
         }
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/function.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/function.js
index 2420fcf2f..9feea15ec 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/function.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/function.js
@@ -48,13 +48,7 @@ define('pgadmin.node.function', [
       id: 'argtype', label: gettext('Data type'), cell:
         'node-ajax-options', cellHeaderClasses: 'width_percent_30',
       control: 'node-ajax-options', type: 'text', url: 'get_types',
-      editable: function(m) {
-        var node_info = this.get('node_info');
-        if(node_info && 'catalog' in node_info) {
-          return false;
-        }
-        return _.isUndefined(m.isNew) ? true : m.isNew();
-      }, first_empty: true,
+      editable: 'isEditable', first_empty: true,
     },{
       id: 'argmode', label: gettext('Mode'), type: 'options',
       control: 'node-ajax-options', cellHeaderClasses:'width_percent_20',
@@ -66,13 +60,7 @@ define('pgadmin.node.function', [
         {'label': 'OUT', 'value': 'OUT'},
         {'label': 'INOUT', 'value': 'INOUT'},
         {'label': 'VARIADIC', 'value': 'VARIADIC'},
-      ], editable: function(m) {
-        var node_info = this.get('node_info');
-        if(node_info && 'catalog' in node_info) {
-          return false;
-        }
-        return _.isUndefined(m.isNew) ? true : m.isNew();
-      },
+      ], editable: 'isEditable',
     },{
       id: 'argname', label: gettext('Argument name'), type: 'text',
       cell: 'string', editable: 'isInCatalog', cellHeaderClasses:'width_percent_30',
@@ -82,6 +70,13 @@ define('pgadmin.node.function', [
     },
     ],
     toJSON: Backbone.Model.prototype.toJSON,
+    isEditable: function(m) {
+      var node_info = this.get('node_info');
+      if(node_info && 'catalog' in node_info) {
+        return false;
+      }
+      return _.isUndefined(m.isNew) ? true : m.isNew();
+    },
     isInCatalog: function(m){
       var node_info = this.get('node_info');
       if(node_info && 'catalog' in node_info) {
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/trigger_function.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/trigger_function.js
index a480a96b6..94d9e9a7b 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/trigger_function.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/trigger_function.js
@@ -48,12 +48,7 @@ define('pgadmin.node.trigger_function', [
       },
       hasSQL: true,
       showMenu: function(itemData, item) {
-        let node = pgBrowser.treeMenu.findNodeByDomElement(item);
-
-        if (!node || node.parentNode.getData()._type === 'trigger')
-          return false;
-
-        return true;
+        return this.canEdit(itemData, item);
       },
       hasDepends: true,
       hasStatistics: true,
diff --git a/web/pgadmin/misc/file_manager/__init__.py b/web/pgadmin/misc/file_manager/__init__.py
index 6a98d4bce..0973df4a2 100644
--- a/web/pgadmin/misc/file_manager/__init__.py
+++ b/web/pgadmin/misc/file_manager/__init__.py
@@ -608,7 +608,7 @@ class Filemanager(object):
                 created = time.ctime(os.path.getctime(system_path))
                 modified = time.ctime(os.path.getmtime(system_path))
                 file_extension = str(splitext(system_path))
-            except Exception as e:
+            except Exception:
                 continue
 
             # set protected to 1 if no write or read permission


view thread (10+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [pgAdmin]:Patch for SonarQube fixes.
  In-Reply-To: <CAJ9T6StbjNif0Gi8_=hv_3GixnPr4zqJDFbHgL83eV0osHNxow@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox