Skip to content

Fix SonarQube Warnings(LDB-11) - #19

Merged
jjwopen merged 4 commits into
mainfrom
jangjunwoo/ldf-11-sonarqube
Aug 10, 2026
Merged

Fix SonarQube Warnings(LDB-11)#19
jjwopen merged 4 commits into
mainfrom
jangjunwoo/ldf-11-sonarqube

Conversation

@jjwopen

@jjwopen jjwopen commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • 개선 사항

    • 모바일 화면에서 사용자가 최대 5배까지 자유롭게 확대할 수 있도록 개선했습니다.
    • 언어 변경 및 초기 로딩 시 번역과 날짜 형식이 더 안정적으로 적용됩니다.
    • 인증 상태 확인 중 화면 전환과 로그인 페이지 리다이렉트가 더욱 안정적으로 처리됩니다.
  • 버그 수정

    • 인증 만료 후 토큰 갱신 처리를 개선해 API 요청 복구 안정성을 높였습니다.
    • 언어 리소스 로딩에 실패할 경우 기본 언어로 안전하게 표시됩니다.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2a195237-68a9-471f-b088-61a173d0028b

📥 Commits

Reviewing files that changed from the base of the PR and between b19ff2a and 2706418.

📒 Files selected for processing (2)
  • src/common/lib/dayjs.ts
  • src/routes/_auth-required/route.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/routes/_auth-required/route.tsx
  • src/common/lib/dayjs.ts

📝 Walkthrough

Walkthrough

인증 리다이렉트와 토큰 갱신 처리를 수정했습니다. Day.js 로케일 초기화와 실패 복구를 변경했습니다. 모듈 경로, viewport 설정 및 프로젝트 버전을 업데이트했습니다.

Changes

런타임 및 모듈 정리

Layer / File(s) Summary
인증 갱신 및 리다이렉트 처리
src/common/lib/api.ts, src/routes/_auth-required/route.tsx, src/routes/auth/route.tsx
토큰 갱신 Promise 할당을 단순화했습니다. 인증 상태 리다이렉트를 지연 처리하고 타이머를 정리합니다. Navigate에는 replace를 적용합니다.
로케일 초기화 처리
src/common/lib/dayjs.ts
언어 변경 시 Day.js 로케일을 설정합니다. 초기화 시 비영어 로케일을 비동기로 로드합니다. 로드에 실패하면 한국어 로케일을 사용합니다.
모듈 연결 및 브라우저 설정
scripts/gen-api.ts, src/features/auth/models/index.ts, index.html, package.json
Node.js 내장 모듈 경로를 명시했습니다. ApiPaths를 원본 모듈에서 직접 재export합니다. 사용자 확대 제한을 제거하고 프로젝트 버전을 0.0.8로 변경했습니다.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AuthRoute
  participant Timer
  participant Navigate
  AuthRoute->>Timer: user 변경 감지
  Timer->>AuthRoute: 0ms 후 shouldRedirect 갱신
  AuthRoute->>Navigate: 미인증 상태에서 replace 리다이렉트
Loading

Possibly related PRs

Poem

토끼가 토큰 갱신을 기다려요
Day.js 로케일을 준비해요
인증 상태가 맞으면 화면을 열고
아니면 기록을 바꿔 이동해요
깡충, 새 버전이 도착했어요! 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 SonarQube 경고 수정이라는 변경 목적을 명확하게 설명하며, 변경된 코드와 관련됩니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jangjunwoo/ldf-11-sonarqube

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jjwopen

jjwopen commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/common/lib/dayjs.ts`:
- Around line 29-30: Remove the i18n.changeLanguage call from the
languageChanged listener in the dayjs locale setup, leaving the handler
responsible only for updating the Day.js locale. Preserve changeLanguage calls
in explicit invocation paths so the listener does not recursively trigger
duplicate language changes or events.
- Around line 31-33: Update the catch blocks in the dayjs locale initialization
and handler paths to avoid dynamically importing the Korean locale again;
statically load the Korean locale once, then use dayjs.locale('ko') in both
fallback paths so they do not reject when the primary locale load fails.

In `@src/routes/_auth-required/route.tsx`:
- Line 15: Update the route’s rendering and redirect guards around
shouldRedirect to check the current user together with the flag. Do not render
the protected Outlet while user is null or while a redirect is pending, and only
redirect when user remains unauthenticated and shouldRedirect is true; allow an
authenticated user to render the Outlet without being redirected.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: af6e63d6-930d-425b-a2e9-e3ee76db53e9

📥 Commits

Reviewing files that changed from the base of the PR and between 695f57f and b19ff2a.

📒 Files selected for processing (8)
  • index.html
  • package.json
  • scripts/gen-api.ts
  • src/common/lib/api.ts
  • src/common/lib/dayjs.ts
  • src/features/auth/models/index.ts
  • src/routes/_auth-required/route.tsx
  • src/routes/auth/route.tsx

Comment thread src/common/lib/dayjs.ts Outdated
Comment thread src/common/lib/dayjs.ts
function AuthRequiredLayout() {
const { user } = useAuth();
const router = useRouter();
const [shouldRedirect, setShouldRedirect] = useState(false);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

지연된 리다이렉트 동안 보호된 Outlet을 렌더링하지 마세요.

useAuth는 토큰이 없을 때 user를 즉시 null로 반환합니다. shouldRedirect의 초기값은 false이므로 첫 렌더에서 보호된 <Outlet />가 반환됩니다. setTimeout(..., 0)이 실행되기 전에 보호된 자식 컴포넌트가 마운트되고 이펙트를 실행할 수 있습니다.

또한 shouldRedirecttrue인 뒤 user가 인증된 객체로 변경되면, 다음 이펙트가 실행되기 전 렌더에서 /auth로 잘못 이동할 수 있습니다. 현재 usershouldRedirect를 함께 검사하세요.

수정 예시
-  if (user === undefined) return <Loading />;
+  if (user === undefined || (user === null && !shouldRedirect)) return <Loading />;

-  if (shouldRedirect) {
+  if (user === null && shouldRedirect) {

근거: src/features/auth/viewmodels/use-auth.ts는 토큰 부재를 null, 사용자 조회 중인 상태를 undefined로 구분합니다.

Also applies to: 20-30, 32-35

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/routes/_auth-required/route.tsx` at line 15, Update the route’s rendering
and redirect guards around shouldRedirect to check the current user together
with the flag. Do not render the protected Outlet while user is null or while a
redirect is pending, and only redirect when user remains unauthenticated and
shouldRedirect is true; allow an authenticated user to render the Outlet without
being redirected.

@jjwopen
jjwopen merged commit 0d770b1 into main Aug 10, 2026
3 checks passed
@jjwopen
jjwopen deleted the jangjunwoo/ldf-11-sonarqube branch August 10, 2026 12:48
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