Skip to content

Commit

Permalink
chore: fix sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yashasvibajpai committed Dec 5, 2024
1 parent 8a2a5c5 commit b3f7140
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const processEvent = async (inputEvent, metricMetadata) => {
}
// attach anonymousId if the event is track event using note_attributes
if (message.type !== EventType.IDENTIFY) {
const anonymousId = await getAnonymousIdFromAttributes(event);
const anonymousId = getAnonymousIdFromAttributes(event);
if (isDefinedAndNotNull(anonymousId)) {
message.setProperty('anonymousId', anonymousId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const getProductsFromLineItems = (lineItems, mapping) => {
}
const products = [];
lineItems.forEach((lineItem) => {
// const product = constructPayload(lineItem, lineItemsMappingJSON);
const product = constructPayload(lineItem, mapping);
products.push(product);
});
Expand All @@ -44,7 +43,7 @@ const createPropertiesForEcomEventFromWebhook = (message) => {
* @param {Object} event
* @returns {String} anonymousId
*/
const getAnonymousIdFromAttributes = async (event) => {
const getAnonymousIdFromAttributes = (event) => {
if (!isDefinedAndNotNull(event) || !isDefinedAndNotNull(event.note_attributes)) {
return null; // Return early if event or note_attributes is invalid

Check warning on line 48 in src/v1/sources/shopify/webhookTransformations/serverSideUtlis.js

View check run for this annotation

Codecov / codecov/patch

src/v1/sources/shopify/webhookTransformations/serverSideUtlis.js#L48

Added line #L48 was not covered by tests
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const {

function getNestedValue(object, path) {
const keys = path.split('.');
return keys.reduce((nestedObject, key) => nestedObject && nestedObject[key], object);
return keys.reduce((nestedObject, key) => nestedObject?.[key], object);
}

function setNestedValue(object, path, value) {
Expand Down

0 comments on commit b3f7140

Please sign in to comment.