Skip to content

fix(sdk): NOSONAR comment for intentional Peer.ready listener registration - #107

Merged
sirdeggen merged 2 commits into
mainfrom
sonar/peer-nosonar
May 8, 2026
Merged

fix(sdk): NOSONAR comment for intentional Peer.ready listener registration#107
sirdeggen merged 2 commits into
mainfrom
sonar/peer-nosonar

Conversation

@sirdeggen

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #103 — adds NOSONAR comment + explanatory note for the single typescript:S7059 alert at packages/sdk/src/auth/Peer.ts:114.

Why intentional

this.transport.onData(...) must register the listener synchronously so paired-peer test mocks see onDataCallback set immediately upon construction. A lazy getter pattern (which Sonar prefers) breaks 13 tests. Field-based .ready is the correct tradeoff here.

Verification

  • pnpm --filter @bsv/sdk run build
  • pnpm --filter @bsv/sdk exec jest 'Peer|AuthFetch' — 116/116 pass

Refs: #38 #45

…ter sync

Lazy getter pattern broke paired-peer test mocks (peerB's onDataCallback
needs to be set when peerA sends). Constructor must register the
transport listener synchronously. Added NOSONAR + explanatory comments
for Sonar S7059 — this single instance is intentionally suppressed.
@codecov

codecov Bot commented May 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sonar's NOSONAR suppression must be at the end of the violating line,
not as a separate comment block. Move suppression to end-of-line on
the constructor assignment with explicit rule ID and reason.
@sirdeggen
sirdeggen merged commit 9e0aa4e into main May 8, 2026
6 checks passed
@sonarqubecloud

sonarqubecloud Bot commented May 8, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant