Fixed the following SonarQube code smells:

1) Do not use the Array index in keys.
2) Import from the same module should be merged.
3) Mutable variables should not be exported.
4) Variables should not be initialized to undefined.
5) startswith or endswith method should be used.
6) Unwrap this unnecessarily grouped subpattern.

Additionally, addressed many other SonarQube rules.
This commit is contained in:
Akshay Joshi
2024-06-12 18:09:06 +05:30
parent 288fd7ed12
commit dea5335ce5
29 changed files with 51 additions and 57 deletions

View File

@@ -10,7 +10,7 @@
import * as Node from 'pgbrowser/node';
import * as SchemaTreeNode from './schema_child_tree_node';
let SchemaChildNode = Node.extend({
const SchemaChildNode = Node.extend({
parent_type: ['schema', 'catalog'],
canDrop: SchemaTreeNode.isTreeItemOfChildOfSchema,
canDropCascade: SchemaTreeNode.isTreeItemOfChildOfSchema,

View File

@@ -587,7 +587,7 @@ export default class ColumnSchema extends BaseUISchema {
}
validate(state, setError) {
let msg = undefined;
let msg;
if (!_.isUndefined(state.cltype) && !isEmptyString(state.attlen)) {
// Validation for Length field

View File

@@ -527,7 +527,7 @@ def parse_rule_definition(res):
condition_part = condition_part_match.group(1)
condition_match = re.search(
r"(?:WHERE)\s+(\([\s\S]*\))\s+(?:DO)", condition_part)
r"(?:WHERE)?\s+(\([\s\S]*\))\s+(?:DO)?", condition_part)
if condition_match is not None:
condition = condition_match.group(1)
@@ -537,7 +537,7 @@ def parse_rule_definition(res):
# Parse data for statements
statement_match = re.search(
r"(?:DO\s+)(?:INSTEAD\s+)?([\s\S]*)(?:;)", data_def)
r"(?:DO\s+)?(?:INSTEAD\s+)?([\s\S]*)(?:;)?", data_def)
statement = ''
if statement_match is not None: