Skip to content

Commit

Permalink
[fix] ktlint 설정 변경 (#42)
Browse files Browse the repository at this point in the history
* [chore] subproject 임시 의존성 comment

* [fix/build] .editorconfig ktlint ij 버전 관련 코드 삭제

* [build] all Project에 ktlint 적용

* [refactor] 모든 모듈 ktlint 적용

* [fix/build] .editorConfigure 추가

* [refactor] 모든 모듈 android ktlint 적용
  • Loading branch information
murjune authored Feb 6, 2024
1 parent d3d1068 commit c32eb24
Show file tree
Hide file tree
Showing 65 changed files with 639 additions and 649 deletions.
24 changes: 1 addition & 23 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,7 @@ tab_width = 2
indent_size = 2

[*.{kt,kts}]

indent_size = 4
tab_width = 4

# Options for IntelliJ IDEA settings
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL

ij_kotlin_line_comment_at_first_column = false
ij_kotlin_line_comment_add_space = true

# These options can keep to use single name import
ij_kotlin_name_count_to_use_star_import = 2147483647
ij_kotlin_name_count_to_use_star_import_for_members = 2147483647

ij_kotlin_keep_blank_lines_in_declarations = 1
ij_kotlin_keep_blank_lines_in_code = 1
ij_kotlin_keep_blank_lines_before_right_brace = 0

# optional but recommended
ij_kotlin_align_multiline_parameters = false
ij_continuation_indent_size = 4
# https://kotlinlang.org/docs/coding-conventions.html#trailing-commas
ij_kotlin_allow_trailing_comma = true
ij_kotlin_packages_to_use_import_on_demand = unset
ij_kotlin_allow_trailing_comma_on_call_site = unset
ktlint_code_style = android_studio
ktlint_function_naming_ignore_when_annotated_with=Composable, Test
3 changes: 1 addition & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
alias(libs.plugins.funch.application)
alias(libs.plugins.funch.compose)
alias(libs.plugins.ktlint)
// alias(libs.plugins.google.services)
// alias(libs.plugins.app.distribution)
// alias(libs.plugins.crashlytics)
Expand All @@ -25,7 +24,7 @@ android {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
"proguard-rules.pro"
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/moya/funch/FunchApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class FunchApplication : Application() {
override fun createStackElementTag(element: StackTraceElement): String {
return "${element.fileName} : ${element.lineNumber} - ${element.methodName}"
}
},
}
)
}
}
Expand Down
11 changes: 4 additions & 7 deletions app/src/main/java/com/moya/funch/navigation/FunchNavHost.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,18 @@ import androidx.navigation.compose.NavHost
import androidx.navigation.compose.rememberNavController

@Composable
fun FunchNavHost(
hasProfile: Boolean,
navController: NavHostController = rememberNavController(),
) {
fun FunchNavHost(hasProfile: Boolean, navController: NavHostController = rememberNavController()) {
NavHost(
navController = navController,
startDestination = determineStartDestination(hasProfile),
startDestination = determineStartDestination(hasProfile)
) {
profileGraph(
onNavigateToHome = navController::navigateToHome,
onCloseMyProfile = navController::closeMyProfile,
onCloseMyProfile = navController::closeMyProfile
)
homeScreen(
onNavigateToMatching = { /* @Gun Hyung TODO : 매칭 라우터 연결 */ },
onNavigateToMyProfile = navController::navigateToMyProfile,
onNavigateToMyProfile = navController::navigateToMyProfile
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/moya/funch/ui/FunchApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ fun FunchApp() {

Surface(
modifier = Modifier.fillMaxSize(),
color = backgroundColor,
color = backgroundColor
) {
FunchNavHost(
hasProfile = false,
hasProfile = false
)
}
}
20 changes: 20 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jlleitschuh.gradle.ktlint.KtlintExtension

buildscript {
repositories {
google()
Expand Down Expand Up @@ -28,6 +30,24 @@ plugins {
// alias(libs.plugins.crashlytics) apply false
}

subprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint") // Version should be inherited from parent

configure<KtlintExtension> {
filter {
exclude { element -> element.file.path.contains("generated/") }
}
android.set(true)
coloredOutput.set(true)
verbose.set(true)
outputToConsole.set(true)
reporters {
reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.PLAIN)
reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.CHECKSTYLE)
}
}
}

tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}
1 change: 0 additions & 1 deletion core/data/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
plugins {
alias(libs.plugins.ktlint)
alias(libs.plugins.funch.android.library)
alias(libs.plugins.funch.junit5)
}
Expand Down
33 changes: 15 additions & 18 deletions core/data/src/main/java/com/moya/funch/mapper/DummyMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,36 @@ package com.moya.funch.mapper
// network response
data class DummyDto(
val id: Int,
val name: String,
val name: String
)

// database entity
data class DummyEntity(
val id: Int,
val name: String,
val name: String
)

// domain model
data class DummyDomain(
val id: Int,
val name: String,
val name: String
)

// toDomain() 함수
fun DummyDto.toDomain(): DummyDomain =
DummyDomain(
id = this.id,
name = name,
)
fun DummyDto.toDomain(): DummyDomain = DummyDomain(
id = this.id,
name = name
)

// toDto() 함수
fun DummyDomain.toDto(): DummyDto =
DummyDto(
id = this.id,
name = name,
)
fun DummyDomain.toDto(): DummyDto = DummyDto(
id = this.id,
name = name
)

// toEntity() 함수

fun DummyDto.toEntity(): DummyEntity =
DummyEntity(
id = this.id,
name = name,
)
fun DummyDto.toEntity(): DummyEntity = DummyEntity(
id = this.id,
name = name
)
1 change: 0 additions & 1 deletion core/datastore/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
plugins {
// alias(libs.plugins.ktlint)
alias(libs.plugins.funch.android.library)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ import javax.inject.Singleton
@Singleton
class DefaultUserCodeDataStore @Inject constructor(
private val preferences: SharedPreferences,
@ApplicationContext private val context: Context,
@ApplicationContext private val context: Context
) : UserCodeDataStore {

override var deviceId: String
get() {
initDeviceId()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import java.security.KeyStore
import javax.inject.Inject

class PreferenceFactory @Inject constructor(
@ApplicationContext private val context: Context,
@ApplicationContext private val context: Context
) {
fun create(): SharedPreferences {
return if (BuildConfig.DEBUG) {
Expand All @@ -27,10 +27,7 @@ class PreferenceFactory @Inject constructor(
}
}

private fun createEncryptedSharedPreferences(
fileName: String,
context: Context,
): SharedPreferences {
private fun createEncryptedSharedPreferences(fileName: String, context: Context): SharedPreferences {
return EncryptedSharedPreferences.create(
context,
fileName,
Expand All @@ -39,7 +36,6 @@ class PreferenceFactory @Inject constructor(
.build(),
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM

)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.moya.funch.datastore

interface UserCodeDataStore {

var userId: String
var userCode: String
var deviceId: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,13 @@ import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
object DataStoreModule {

@Provides
@Singleton
fun provideAppPreferences(
factory: PreferenceFactory,
): SharedPreferences = factory.create()
fun provideAppPreferences(factory: PreferenceFactory): SharedPreferences = factory.create()

@Module
@InstallIn(SingletonComponent::class)
abstract class Binder {

@Binds
abstract fun bindAppPreferences(dataStore: DefaultUserCodeDataStore): UserCodeDataStore
}
Expand Down
1 change: 0 additions & 1 deletion core/designsystem/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ plugins {
android {
namespace = "com.moya.funch.designsystem"
}

Loading

0 comments on commit c32eb24

Please sign in to comment.