mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixes following code smell reported by SonarQube:
1) Replace this if-then-else flow by a single return statement 2) Remove the unnecessary boolean literals.
This commit is contained in:
@@ -139,18 +139,12 @@ export default class BaseUISchema {
|
||||
|
||||
/* Check if node in catalog */
|
||||
inCatalog() {
|
||||
if(this.nodeInfo && 'catalog' in this.nodeInfo) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return this.nodeInfo && 'catalog' in this.nodeInfo;
|
||||
}
|
||||
|
||||
/* Check readonly on the basis of new state */
|
||||
isReadOnly(state) {
|
||||
if(!this.isNew(state)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return !this.isNew(state);
|
||||
}
|
||||
|
||||
/* Get the server version */
|
||||
|
||||
@@ -117,10 +117,7 @@
|
||||
//this reg will check the token should be in format as - IF condition or IF(condition)
|
||||
let reg = `\\b\\${startToken}\\s*\\(\\w*\\)(?!\\w)|\\b\\${startToken}\\(\\w*\\)(?!\\w)|\\b\\${startToken}\\s*(?!\\w)`;
|
||||
let regex = RegExp(reg, 'g');
|
||||
if(regex.exec(text) !== null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return regex.exec(text) !== null;
|
||||
}
|
||||
|
||||
CodeMirror.registerHelper('fold', 'sql', function(cm, start) {
|
||||
|
||||
@@ -347,10 +347,7 @@ export default function PgTable({ columns, data, isSelectRow, caveTable=true, sc
|
||||
setHiddenColumns(
|
||||
columns
|
||||
.filter((column) => {
|
||||
if (column.isVisible === undefined || column.isVisible === true) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return !(column.isVisible === undefined || column.isVisible === true);
|
||||
}
|
||||
)
|
||||
.map((column) => column.accessor)
|
||||
|
||||
Reference in New Issue
Block a user