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:
Akshay Joshi
2022-01-18 14:49:54 +05:30
parent e3807ec3d6
commit 9f836f5433
62 changed files with 367 additions and 319 deletions

View File

@@ -293,8 +293,8 @@ const setZoomEvents = () => {
// This function is used to iterate all open windows and set the zoom level.
const setZoomLevelForAllWindows = () => {
nw.Window.getAll(function(winArray) {
for (var i = 0; i < winArray.length; i++) {
winArray[i].zoomLevel = pgAdminWindowObject.zoomLevel;
for (let arr_val of winArray) {
arr_val.zoomLevel = pgAdminWindowObject.zoomLevel;
}
})
};
@@ -336,9 +336,9 @@ const toggleFullScreen = () => {
// Change the menu label.
var menu_label = pgAdminWindowObject.window.document.querySelector('#mnu_toggle_fullscreen_runtime span').innerHTML;
if (menu_label.indexOf('Enter Full Screen') > 0) {
if (menu_label.indexOf('Enter Full Screen') >= 0) {
pgAdminWindowObject.window.document.querySelector('#mnu_toggle_fullscreen_runtime span').innerHTML = menu_label.replace('Enter', 'Exit');
} else if (menu_label.indexOf('Exit Full Screen') > 0) {
} else if (menu_label.indexOf('Exit Full Screen') >= 0) {
pgAdminWindowObject.window.document.querySelector('#mnu_toggle_fullscreen_runtime span').innerHTML = menu_label.replace('Exit', 'Enter');
}
}