-
Notifications
You must be signed in to change notification settings - Fork 0
전역 Ktlint 적용 및 기타 작업 수행 #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
전반적인 코드 베이스에서 Metro DI와 관련된 생성자 주입 스타일을 통일하고 일부 코드를 정리했습니다.
- **생성자 주입 스타일 통일:**
- `@Inject constructor(...)` 형식으로 작성된 모든 클래스의 생성자 주입 코드를 `@Inject class ... (...)` 형식으로 변경하여 어노테이션 위치를 클래스 선언부로 통일했습니다. 이는 코드 가독성을 높이고 일관된 스타일을 유지하기 위함입니다.
- 대상 파일: `DataSource`, `Repository`, `ViewModel`, `Fragment`, `Interceptor`, `Factory` 등 다수의 클래스
- **`FragmentUtil.kt` 코드 정리:**
- 더 이상 사용되지 않는 `getObject(key: String)` 확장 함수를 삭제했습니다.
- API 33(Android 13, UPSIDE_DOWN_CAKE) 미만 버전에서 `getSerializableExtra`, `getParcelableExtra` 등을 호출할 때 발생하는 `DEPRECATION` 경고를 억제하기 위해 `@Suppress("DEPRECATION")` 어노테이션을 추가했습니다.
기존에 `@Inject` 어노테이션을 사용하여 필드로 주입받던 `ViewModelProvider.Factory` 및 기타 의존성들을 프래그먼트의 생성자를 통해 주입하도록 리팩토링했습니다. 이를 통해 의존성 주입 시점을 명확히 하고, 불변성(immutability)을 확보하여 코드의 안정성을 높였습니다.
- **대상 프래그먼트:**
- `HomeFragment`
- `PlaceCategoryFragment`
- `PlaceDetailPreviewFragment`
- `PlaceDetailPreviewSecondaryFragment`
- `PlaceListFragment`
- `PlaceMapFragment`
- `ScheduleFragment`
- `SettingFragment`
- **`ExploreViewModel.kt` 수정:**
- `debounce` 사용을 위해 필요한 `@FlowPreview` 어노테이션을 클래스 레벨에 추가했습니다.
Compose 환경의 테마 시스템(`FestabookTheme`)을 확장하여, 기존에 객체(`object`)로 정의되었던 `FestabookColor`와 `FestabookTypography`를 `CompositionLocalProvider`를 통해 주입하도록 구조를 변경했습니다. 이를 통해 테마 값에 대한 접근 방식을 통일하고 재사용성을 높였습니다.
- **`FestabookTheme.kt` 수정:**
- `CompositionLocalProvider`에 `LocalColor`와 `LocalTypography`를 추가하여, 하위 컴포저블에서 `FestabookColor`와 `FestabookTypography`를 통해 테마의 색상과 타이포그래피에 접근할 수 있도록 설정했습니다.
- **`FestabookColor.kt` 리팩토링:**
- 기존의 `object FestabookColor`를 `data class FestabookColorPalette`로 변경했습니다.
- `staticCompositionLocalOf`를 사용하여 `LocalColor`를 정의하고, `@Composable` `get()` 프로퍼티인 `FestabookColor`를 통해 테마 색상에 접근하도록 수정했습니다.
- **`FestabookTypography.kt` 리팩토링:**
- 기존의 `val FestabookTypography`를 `FestabookTypographies`로 이름을 변경했습니다.
- `staticCompositionLocalOf`로 `LocalTypography`를 정의하고, `@Composable` `get()` 프로퍼티인 `FestabookTypography`를 추가하여 테마 타이포그래피에 접근할 수 있도록 개선했습니다.
- **`FestabookSpacing.kt` & `FestabookShapes.kt` 수정:**
- `get()` 프로퍼티에 `@ReadOnlyComposable` 어노테이션을 추가하여 컴포지션 최적화를 개선했습니다.
- **`themes.xml` 수정:**
- `android:windowBackground` 값을 `@color/gray050`에서 하드코딩된 `#FAFAFA`로 변경하여, 새로운 테마 시스템의 색상 값(`white`)과 일치시켰습니다.
ktlint의 Compose 관련 규칙을 프로젝트에 새로 적용하고, 이에 따라 발견된 코드 스타일 및 컨벤션 문제를 수정했습니다.
- **ktlint Compose 규칙 적용:**
- `gradle/libs.versions.toml`과 `app/build.gradle.kts`에 `ktlint-compose` 의존성을 추가했습니다.
- `.editorconfig` 파일에 `compose_allowed_composition_locals` 설정을 추가하여 `LocalColor`, `LocalTypography` 등의 사용을 허용했습니다.
- **코드 스타일 및 컨벤션 수정:**
- `@Composable` 함수의 네이밍 컨벤션에 맞춰 `@Preview` 함수의 이름을 `PascalCase`에서 `private` 접근자의 `camelCase`로 변경했습니다. (`CoilImage.kt`)
- `TimeTagMenu.kt`에서 의미가 불분명했던 콜백 파라미터명 `onSizeDetermined`를 `onSizeDetermine`으로 더 명확하게 수정했습니다.
- `PullToRefreshContainer.kt` 컴포저블의 파라미터 순서를 Modifier가 마지막에 오도록 조정했습니다.
- `LostItemScreen.kt`에서 `EmptyStateScreen` 호출 시 불필요하게 전달되던 Modifier를 제거했습니다.
|
Caution Review failedFailed to post review comments WalkthroughThis pull request refactors dependency injection patterns across data sources and repositories, introduces a new Compose-based theming system with composition locals, rewrites the news feature UI from XML fragments to Compose, converts state management from LiveData to StateFlow for news and place map features, and updates fragment constructor injection patterns. Additionally, it adds ktlint support and simplifies Android CI/CD workflows. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~65 minutes Areas requiring extra attention during review:
Possibly related issues
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
etama123
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
밀러 고생하셨습니다 ~~
parkjiminnnn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생했어요 밀러!
#️⃣ 이슈 번호
🛠️ 작업 내용
@ReadOnlyComposable어노테이션을 붙였습니다.🙇🏻 중점 리뷰 요청
확인 사항
현재 Twitter의 Compose Lint 의 릴리즈 날짜가 2022년으로 지원이 사실상 중단되었습니다.
이로 인해 https://mrmans0n.github.io/compose-rules/latest/ 의 Compose Lint를 사용하였습니다.
버전별로, 라이브러리 제작사 별로 ruleset이 조금씩 다릅니다 이 점을 감안해주시면 감사하겠습니다.
FestabookColor, FestabookTyphography는 충돌을 줄이고자,CompositionLocal의 getter 함수에 기존 FestabookColor, FestabookTyphography 네이밍을 차용했습니다.
ViewModelTest가 동작하도록 몇 가지 요소를 수정하였습니다.
@Inject어노테이션 관련해서 무수히 많은 컴파일러 경고를 줄이고자 몇 가지 부분을 수정했습니다자세한 내용은 슬랙을 참고해주세요
https://festabook.slack.com/archives/C099EFY59RA/p1765181074465119
https://festabook.slack.com/archives/C09RFB02A9W/p1765183498967429?thread_ts=1765098976.624099&cid=C09RFB02A9W
📸 이미지 첨부 (Optional)
Summary by CodeRabbit
Release Notes
New Features
UI Improvements
Build & Quality
Chores
✏️ Tip: You can customize this high-level summary in your review settings.