From 812b4878766489a68026ef7d3d17d4ad81590006 Mon Sep 17 00:00:00 2001 From: Serhii Filonenko Date: Thu, 11 Jul 2024 12:38:22 +0300 Subject: [PATCH 1/2] HCK-7070: fix sonar issues --- forward_engineering/helpers/commentIfDeactivated.js | 2 +- forward_engineering/helpers/indexHelper.js | 2 +- .../reverseEngineeringService/helpers/reorderTableRows.js | 2 +- .../reverseEngineeringService/helpers/reverseTableColumn.js | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/forward_engineering/helpers/commentIfDeactivated.js b/forward_engineering/helpers/commentIfDeactivated.js index 152d1d1..4ef1e93 100644 --- a/forward_engineering/helpers/commentIfDeactivated.js +++ b/forward_engineering/helpers/commentIfDeactivated.js @@ -1,5 +1,5 @@ const BEFORE_DEACTIVATED_STATEMENT = '-- '; -const REG_FOR_MULTYLINE_COMMENT = /(\n\/\*\n[\s\S]*?\n\s\*\/\n)|(\n\/\*\n[\s\S]*?\n\s\*\/)$/gi; +const REG_FOR_MULTYLINE_COMMENT = /(\n\/\*\n[\s\S]*?\n\s\*\/\n)$|(\n\/\*\n[\s\S]*?\n\s\*\/)$/gi; const commentIfDeactivated = (statement, data, isPartOfLine) => { if (data?.hasOwnProperty('isActivated') && !data.isActivated) { diff --git a/forward_engineering/helpers/indexHelper.js b/forward_engineering/helpers/indexHelper.js index a84d629..382ad1e 100644 --- a/forward_engineering/helpers/indexHelper.js +++ b/forward_engineering/helpers/indexHelper.js @@ -223,7 +223,7 @@ module.exports = app => { const createTableIndex = (terminator, tableName, index, isParentActivated) => { if (index.type === 'spatial') { - return createSpatialIndex(terminator, tableName, index, isParentActivated); + return createSpatialIndex(terminator, tableName, index); } else if (index.type === 'fulltext') { return createFullTextIndex(terminator, tableName, index); } else { diff --git a/reverse_engineering/reverseEngineeringService/helpers/reorderTableRows.js b/reverse_engineering/reverseEngineeringService/helpers/reorderTableRows.js index 9ab697a..032275d 100644 --- a/reverse_engineering/reverseEngineeringService/helpers/reorderTableRows.js +++ b/reverse_engineering/reverseEngineeringService/helpers/reorderTableRows.js @@ -7,7 +7,7 @@ const reorderTableRows = (tableRows, isFieldOrderAlphabetic) => { return tableRows; } - const reorderedFieldNames = Object.keys(tableRows[0]).sort(); + const reorderedFieldNames = Object.keys(tableRows[0]).sort((a, b) => a?.localeCompare(b)); return tableRows.map(row => Object.values(row).reduce( (columns, columnValue, i) => ({ diff --git a/reverse_engineering/reverseEngineeringService/helpers/reverseTableColumn.js b/reverse_engineering/reverseEngineeringService/helpers/reverseTableColumn.js index ebdb662..89933c1 100644 --- a/reverse_engineering/reverseEngineeringService/helpers/reverseTableColumn.js +++ b/reverse_engineering/reverseEngineeringService/helpers/reverseTableColumn.js @@ -52,8 +52,8 @@ const handleDefault = (typeObject, value) => { const validValue = { numeric: Number(value.replace(/(^\(\()|(\)\)$)/g, '')), - char: value.replace(/(^\(\')|(\'\))$/g, ''), - xml: value.replace(/(^\(N\')|(\'\))$/g, ''), + char: value.replace(/(^\(')$|('\))$/g, ''), + xml: value.replace(/(^\(N')$|('\))$/g, ''), }[typeObject.type]; return { default: validValue !== undefined ? validValue : value }; From 4535f36eba6537674d3ec47ac7f02b4d8444c194 Mon Sep 17 00:00:00 2001 From: Serhii Filonenko Date: Thu, 11 Jul 2024 12:40:03 +0300 Subject: [PATCH 2/2] HCK-7070: fix sonar issues --- .../reverseEngineeringService/helpers/reorderTableRows.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reverse_engineering/reverseEngineeringService/helpers/reorderTableRows.js b/reverse_engineering/reverseEngineeringService/helpers/reorderTableRows.js index 032275d..864a824 100644 --- a/reverse_engineering/reverseEngineeringService/helpers/reorderTableRows.js +++ b/reverse_engineering/reverseEngineeringService/helpers/reorderTableRows.js @@ -7,7 +7,7 @@ const reorderTableRows = (tableRows, isFieldOrderAlphabetic) => { return tableRows; } - const reorderedFieldNames = Object.keys(tableRows[0]).sort((a, b) => a?.localeCompare(b)); + const reorderedFieldNames = Object.keys(tableRows[0]).sort((a, b) => a?.localeCompare?.(b)); return tableRows.map(row => Object.values(row).reduce( (columns, columnValue, i) => ({