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:
Akshay Joshi
2022-09-08 19:56:02 +05:30
parent 7086719640
commit b8f63adf41
47 changed files with 193 additions and 598 deletions

View File

@@ -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 */

View File

@@ -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) {

View File

@@ -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)