mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed following code smells reported by SonarQube:
1) Immediately return this expression instead of assigning it to the temporary variable. 2) Extract this nested ternary operation into an independent statement. 3) Expected a `for-of` loop instead of a `for` loop with this simple iteration.
This commit is contained in:
@@ -77,7 +77,7 @@ export function initialize(gettext, url_for, $, _, pgAdmin, csrfToken, pgBrowser
|
||||
|
||||
erdToolEnabled: function(obj) {
|
||||
/* Same as query tool */
|
||||
var isEnabled = (() => {
|
||||
return (() => {
|
||||
if (!_.isUndefined(obj) && !_.isNull(obj)) {
|
||||
if (_.indexOf(pgAdmin.unsupported_nodes, obj._type) == -1) {
|
||||
if (obj._type == 'database' && obj.allowConn) {
|
||||
@@ -94,7 +94,6 @@ export function initialize(gettext, url_for, $, _, pgAdmin, csrfToken, pgBrowser
|
||||
return false;
|
||||
}
|
||||
})();
|
||||
return isEnabled;
|
||||
},
|
||||
|
||||
// Callback to draw ERD Tool for objects
|
||||
|
||||
@@ -8,9 +8,8 @@
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
import * as React from 'react';
|
||||
import { CanvasWidget } from '@projectstorm/react-canvas-core';
|
||||
import { CanvasWidget, Action, InputType } from '@projectstorm/react-canvas-core';
|
||||
import axios from 'axios';
|
||||
import { Action, InputType } from '@projectstorm/react-canvas-core';
|
||||
import PropTypes from 'prop-types';
|
||||
import _ from 'lodash';
|
||||
import html2canvas from 'html2canvas';
|
||||
@@ -40,8 +39,8 @@ export class KeyboardShortcutAction extends Action {
|
||||
});
|
||||
this.shortcuts = {};
|
||||
|
||||
for(let i=0; i<shortcut_handlers.length; i++){
|
||||
let [key, handler] = shortcut_handlers[i];
|
||||
for(let shortcut_val of shortcut_handlers){
|
||||
let [key, handler] = shortcut_val;
|
||||
if(key) {
|
||||
this.shortcuts[this.shortcutKey(key.alt, key.control, key.shift, false, key.key.key_code)] = handler;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user