Skip to content

fix: SonarQube cleanup batch 2 + habit-card refactoring - #4

Merged
thomasluizon merged 4 commits into
mainfrom
fix/sonarqube-web-cleanup
Apr 5, 2026
Merged

fix: SonarQube cleanup batch 2 + habit-card refactoring#4
thomasluizon merged 4 commits into
mainfrom
fix/sonarqube-web-cleanup

Conversation

@thomasluizon

Copy link
Copy Markdown
Owner

Summary

  • Reduce habit-card cognitive complexity from 87 to under 15 by extracting sub-components
  • Fix all remaining SonarQube issues: accessibility (native elements), nested ternaries, array index keys, useless assignments, cognitive complexity across 14 components/pages
  • Update tests to match accessibility refactoring (native progress, checkbox, article elements)
  • 1210 tests passing across 116 files, 0 failures

Test plan

  • npx vitest run - 1210 tests, 116 files, all passing
  • npx turbo run type-check - web passes (mobile has pre-existing errors)
  • Verify habit-card renders identically after refactoring

🤖 Generated with Claude Code

thomasluizon and others added 4 commits April 4, 2026 23:06
- S4144: Deduplicate route handlers into single handler function
- S6819: Replace ARIA roles with native HTML (section, nav, progress, label+input)
- S6479: Replace array index keys with content-based keys
- S7721: Extract pure functions to outer scope (factCategoryColor, isValidTime, etc.)
- S3358: Flatten nested ternaries into if/else or &&-chains
- S6852: Add tabIndex/aria-label to interactive role elements
- S6847: Fix non-interactive elements with click handlers
- S3776: Reduce cognitive complexity via helper extraction
- Additional linter auto-fixes for code quality

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- S7735: Fix negated conditions - swap ternary branches to positive first
  - habit-form-fields.tsx: hasProAccess positive branch first
  - message-bubble.tsx: dismissedBreakdowns.has() positive branch first
- S6582: Use optional chaining for movingHabit?.parentId
- S4043: Copy array before sort with [...overdueHabits].sort()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract sub-components: CompletionButton, SelectCheckbox, HabitBadges,
HabitMeta, ActionButtons, ActionsMenu. Replace nested ternaries with
helper functions. Fix accessibility issues (native elements).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Apr 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
orbit-ui-mobile-web Ready Ready Preview, Comment Apr 5, 2026 2:32am

@thomasluizon
thomasluizon merged commit 6baf47d into main Apr 5, 2026
4 checks passed
@sonarqubecloud

sonarqubecloud Bot commented Apr 5, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
54.8% Coverage on New Code (required ≥ 80%)
B Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@thomasluizon
thomasluizon deleted the fix/sonarqube-web-cleanup branch April 5, 2026 17:52
thomasluizon added a commit that referenced this pull request Apr 15, 2026
…ferral/JWT

Security hardening on the web BFF auth layer:

- Dedicated /api/auth/{send-code,verify-code,google,logout} routes now call
  buildForwardedClientHeaders(request) so X-Forwarded-For / CF-Connecting-IP /
  X-Orbit-Country-Code / Accept-Language / X-Orbit-Time-Zone reach the .NET
  backend. Previously these routes sent no client context, so the backend's
  DistributedRateLimitFilter partitioned every anonymous auth request under
  the Next.js server IP — collapsing the per-client 5 req/min bucket.

- auth_token cookie maxAge changed from 86_400 (1 day) to 604_800 (7 days) so
  it matches the backend JwtSettings.ExpiryHours=168. Prevents daily forced
  token refresh round-trips.

- Length-cap the JWT payload segment in /api/auth/session before JSON.parse
  (4 KB ceiling). Blocks a memory-amplification vector where a malicious
  cookie contains a megabyte-scale base64 segment.

- Cap referral query-param at 40 chars before cookie write on the login page.

Includes new unit tests for send-code header forwarding and updates
auth-api.test.ts to assert the 7-day maxAge.

Covers frontend plan Area A #1, #2, #4, #5.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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