Skip to content

Fix the findings Sonar reports now that it resolves types - #1399

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

LunaUrsa merged 1 commit into
uatfrom
fix/sonar-third

Conversation

@LunaUrsa

Copy link
Copy Markdown
Contributor

Summary

After #1398 the SonarScan job installs dependencies, so Sonar now sees the discord.js types. That surfaced 110 findings it couldn't evaluate before.

  • Deprecated API (S1874, 76): modals use LabelBuilder / addLabelComponents instead of the deprecated ActionRow + TextInputBuilder.setLabel pattern (46 inputs, 16 files); role colour uses colors.primaryColor; StringSelect* names; GuildExpressions.
  • Stringification (S6551, 29): missingPermission now returns a readable permission name (permissionName), member/channel mentions are cast so they print correctly, audit-log values are serialized.
  • Bugs found by the scan: d.setup.ts didn't await a channel fetch (it printed [object Promise]); d.rpg.ts didn't await the premium role add, so the token refund in its catch could never run.
  • Smaller items: two RegExp.exec, a pointless await, one redundant cast.

Things to review

  • Modal layout now uses Discord's label component. Tests cover it through mocks, but it deserves a real check of one or two modals (e.g. /feedback, a mod action modal, /setup).
  • Audit-log change text shows JSON for object values instead of [object Object].
  • missingPermission now returns string | null instead of PermissionResolvable | null.

Verification

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

🤖 Generated with Claude Code

With dependencies installed the scan sees the discord.js types, which
surfaced deprecated API use and unsafe stringification:

- modals use LabelBuilder/addLabelComponents instead of the deprecated
  ActionRow + TextInputBuilder.setLabel pattern (46 inputs)
- Role colour via colors.primaryColor, StringSelect* names, GuildExpressions
- missingPermission returns a readable permission name (permissionName),
  and member/channel mentions are cast or formatted so no template prints
  [object Object]
- d.setup awaited the tripsit channel fetch (it printed [object Promise])
- await the premium role add so the token refund can actually trigger
- RegExp.exec, a pointless await, and a redundant cast

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:43
@LunaUrsa
LunaUrsa merged commit 781baa5 into uat Nov 15, 2026
12 checks passed
@LunaUrsa
LunaUrsa deleted the fix/sonar-third branch November 15, 2026 19:46
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