Skip to content

Fix the remaining SonarQube findings and give the scan real types - #1398

Merged
LunaUrsa merged 1 commit into
uatfrom
fix/sonar-remaining
Nov 15, 2026
Merged

LunaUrsa merged 1 commit into
uatfrom
fix/sonar-remaining

Conversation

@LunaUrsa

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #1397 for the findings Sonar still reports on main.

  • Empty-string fallbacks that used || are spelled with length checks or a small orDefault helper (so /hr, quotes, deleted messages and mod history still fall back on empty text); ?? is used where the value is never empty.
  • Optional chains in modUtils/tents, a boolean list in the voice-exp check, a rate-limit sublimit of 0 still falls back to the retry delay.
  • removeReactionRole is split into two paths instead of branching on a boolean; listFeeds no longer returns a constant; narrower types for the audit-log unit formatter; redundant assertions removed.
  • The SonarScan jobs in PushToUat.yml and PushToMain.yml now run npm ci --legacy-peer-deps and npm run db:generate first. Without dependencies the scanner couldn't see discord.js/Prisma types, so it reported ~22 casts that TypeScript actually requires as "unnecessary" (S4325).

Verification

  • tsc (app and vitest configs), ESLint on changed files: clean.
  • npx vitest run --coverage: 2,264 passed, coverage 100%.
  • Not verified: the Sonar count itself, which only updates after CI scans this branch.

🤖 Generated with Claude Code

- keep empty-string fallbacks but spell them without || (length checks, a
  small orDefault helper) or use ?? where the value is never empty
- optional chains in modUtils and tents, boolean list in timer
- split removeReactionRole into two paths instead of branching on a boolean
- listFeeds no longer returns a constant; narrower types for the
  audit-log unit formatter
- drop redundant assertions that TypeScript doesn't need
- install dependencies and generate the Prisma clients in the SonarScan
  jobs (uat and main) so type-aware rules see discord.js/Prisma types
  instead of reporting casts as unnecessary

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@LunaUrsa
LunaUrsa requested a review from a team as a code owner November 15, 2026 19:16
@LunaUrsa
LunaUrsa merged commit ad0e9dd into uat Nov 15, 2026
12 checks passed
@LunaUrsa
LunaUrsa deleted the fix/sonar-remaining branch November 15, 2026 19:19
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