Repository navigation
Conversation
…oordinates.value in ModalState.componentDidMount Consumed only via a truthiness check (thisAddressCoords && thisAddressCoords.length > 0); every falsy-but-defined intermediate short-circuits to the same falsy outcome under both forms. File: react/ModalState.js:66 Rule: javascript:S6582
…oords in ModalState.componentDidUpdate address, address.geoCoordinates and address.geoCoordinates.value are always either nullish or an object/array — never another falsy primitive — so && and ?. short-circuit identically here. File: react/ModalState.js:94 Rule: javascript:S6582
…dress.street.value guard chain Feeds a || '' fallback further down, which coalesces every falsy outcome to '' under both the guard-chain and optional-chain forms. File: react/PickupPointsModal.js:41 Rule: javascript:S6582
…l-code guard address.country.value === 'ARG' still short-circuits correctly and keeps address non-null for the postalCode check that follows. File: react/PickupPointsModal.js:112,115 Rule: javascript:S6582
…tal-code regex \d is exactly [0-9] under every flag combination used on this literal (only 'g'), so the match result is unchanged. File: react/PickupPointsModal.js:118 Rule: javascript:S6353
…alCode.value getter Only caller site is inside an if (address.postalCode) block, which already guarantees address.postalCode is truthy here. File: react/PickupPointsModal.js:126 Rule: javascript:S6582
…talCode value/valid access validatedPostalCode is a local object literal built a few lines above in the same function, always truthy at this point. File: react/PickupPointsModal.js:154,155 Rule: javascript:S6582
…s.country in PickupPointsModal Flows into newAddress, which normalizes country with 'country || null' — every falsy input collapses to null identically under both forms. File: react/PickupPointsModal.js:171 Rule: javascript:S6582
…sition-sync effect The null guard and the two coordinate comparisons collapse into optional chaining: when getPosition() returns null, currentPosition?.lat() is undefined, and undefined !== lat is always true (lat defaults to a real number), reproducing the original short-circuit. File: react/components/GoogleMarker.tsx:135 Rule: typescript:S6582
…line Prettier reflow only, no functional change. File: react/ModalState.js:64
…to one line Prettier reflow only, no functional change. File: react/PickupPointsModal.js:106
|
Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖 Please select which version do you want to release:
And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.
|
🛡️ SDD Check — action requiredI couldn't detect an SDD in this PR. Please check one option below (requires write access to the repo):
|
…csInfo.find in ModalState data.logisticsInfo is always either nullish or an array (an API response field, never another falsy primitive), so && and ?. short-circuit identically. The adjacent unflagged availablePickupLI && findSla(...) chain two lines below is untouched — it's a separate expression outside this issue's range. File: react/ModalState.js:422 Rule: javascript:S6582
|
huandrey
left a comment
There was a problem hiding this comment.
Self-review before asking for approval: I checked each optional-chaining conversion for a falsy-but-defined divergence (null/0/'' short-circuiting differently than ?.). None change behavior; the two non-obvious ones are noted inline.
| currentPosition.lat() !== lat || | ||
| currentPosition.lng() !== lng | ||
| ) { | ||
| if (currentPosition?.lat() !== lat || currentPosition?.lng() !== lng) { |
There was a problem hiding this comment.
Equivalent to the old currentPosition == null || …: when currentPosition is null, currentPosition?.lat() is undefined, and undefined !== lat is always true because lat/lng come from position ?? [0, 0] (line 107), so they are never undefined. The marker is still repositioned in that case.
| searchAddress && | ||
| searchAddress.country && | ||
| searchAddress.country.value, | ||
| country: searchAddress?.country?.value, |
There was a problem hiding this comment.
The old searchAddress && searchAddress.country && searchAddress.country.value could return null/false, while ?. returns undefined. That difference disappears because newAddress normalizes it with country || null. The same reasoning covers validatedPostalCode?.value (always an object literal) and address.postalCode?.value (only reached after getValidPostalCode checked address.postalCode is truthy).

0 New Issues
12 Fixed Issues
0 Accepted Issues
SonarQube auto-fix — type-dependent
Generated by
sonar-autofix. Each commit resolves one issue (two combined pairs where the flagged lines share one statement and cannot be split independently). All fixes were independently reviewed by a judge-agent before being committed. Two follow-up commits are Prettier-only reflow, triggered by the shorter lines now fitting the width limit.Skipped in this group: 0 issues
Overlap note:
react/ModalState.jsandreact/PickupPointsModal.jsare root/public components per AGENTS.md and require human approval before merge. This PR's ModalState.js/PickupPointsModal.js fixes substantially overlap with the already-open #223 (branchfix/sonar-t1-t2-round2), opened before this autofix run — same rules, same or adjacent lines, produced independently. @huandrey: please compare both and close whichever isn't kept.