Skip to content

Commit

Permalink
HCK-7052 - Fix sonar reports (#136)
Browse files Browse the repository at this point in the history
* Fix sonar reports

* Update typeHelper.js

---------

Co-authored-by: chulanovskyi-bs <[email protected]>
  • Loading branch information
bigorn0 and chulanovskyi-bs authored Jul 12, 2024
1 parent 1b3fbc5 commit 207cdd7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions forward_engineering/helpers/alterScriptFromDeltaHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ const getPropertiesForUpdateTable = (properties = []) => {
}
const newField = value.compMod?.newField || {};
const oldField = value.compMod?.oldField || {};
Object.entries(newField).map(([keyNewField, valueNewField]) => {
Object.entries(newField).forEach(([keyNewField, valueNewField]) => {
if (oldField[keyNewField] !== valueNewField) {
value[keyNewField] = valueNewField;
}
if (keyNewField === 'name' && oldField[keyNewField] !== valueNewField) {
name = valueNewField;
}
}
});
return [name, value];
});
Expand Down
10 changes: 4 additions & 6 deletions forward_engineering/helpers/typeHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const ifType = type => {
const getModeType = (type, defaultType, udtTypeMap) => {
if (type) {
const mode = getFieldConfig(type, 'mode');
const definedType = mode && mode.options ? mode.options[0] : type;
const definedType = mode?.options ? mode.options[0] : type;

return getHandlerByType(
type,
Expand Down Expand Up @@ -91,7 +91,7 @@ const getStructuralTypeHandler = (type, isNeedToBeFrozen, udtTypeMap) => {
const typeConfig = getTypeConfig(arraySchema.type);
if (typeConfig.subtypes && arraySchema.subtype) {
const subTypeConfig = typeConfig.subtypes[arraySchema.subtype];
if (subTypeConfig && subTypeConfig.childValueType) {
if (subTypeConfig?.childValueType) {
return getModeType(subTypeConfig.childValueType, defaultType, udtTypeMap);
}
}
Expand All @@ -113,7 +113,7 @@ const getStructuralTypeHandler = (type, isNeedToBeFrozen, udtTypeMap) => {
const typeConfig = getTypeConfig(objectSchema.type);
if (typeConfig.subtypes && objectSchema.subtype) {
const subTypeConfig = typeConfig.subtypes[objectSchema.subtype];
if (subTypeConfig && subTypeConfig.childValueType) {
if (subTypeConfig?.childValueType) {
return getModeType(subTypeConfig.childValueType, defaultType, udtTypeMap);
}
}
Expand All @@ -133,8 +133,6 @@ const getStructuralTypeHandler = (type, isNeedToBeFrozen, udtTypeMap) => {

if (nestedType !== undefined) {
return nestedType;
} else {
('');
}
} else {
return 'text';
Expand All @@ -157,7 +155,7 @@ const getStructuralTypeHandler = (type, isNeedToBeFrozen, udtTypeMap) => {
const keyType = canTypeHaveSubtype(propertyData.keyType, propertyData.keySubtype)
? propertyData.keySubtype
: getModeType(propertyData.keyType, 'text', udtTypeMap);
const valueType = getValueTypeFromObject(propertyData, 'text', udtTypeMap, propertyName);
const valueType = getValueTypeFromObject(propertyData, 'text', udtTypeMap);

return `map<${keyType}, ${valueType}>`;
};
Expand Down

0 comments on commit 207cdd7

Please sign in to comment.