Skip to content
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

[chore] git hook pre-push 시기에 ktlint 체크하도록 스크립트 적용 #9 #10

Merged
merged 6 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
root = true

[*]
charset = utf-8
indent_size = 4
indent_style = space
max_line_length = 150
insert_final_newline = true
trim_trailing_whitespace = true
ktlint_standard_filename = disabled
ktlint_standard_import-ordering = disabled
ktlint_standard_wrapping = disabled
ktlint_standard_argument-list-wrapping = disabled
ktlint_standard_multiline-if-else = disabled
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled
ktlint_standard_no_blank_line_in_list = disabled

[*.{kt,kts}]
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true
ktlint_function_naming_ignore_when_annotated_with=Composable
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ dependencies {
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
debugImplementation(libs.androidx.compose.ui.tooling)
debugImplementation(libs.androidx.compose.ui.test.manifest)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ package com.nexters.ziine.android

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
Expand All @@ -21,4 +19,4 @@ class ExampleInstrumentedTest {
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.nexters.ziine.android", appContext.packageName)
}
}
}
7 changes: 5 additions & 2 deletions app/src/main/java/com/nexters/ziine/android/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ class MainActivity : ComponentActivity() {
}

@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
fun Greeting(
name: String,
modifier: Modifier = Modifier
) {
Text(
text = "Hello $name!",
modifier = modifier
Expand All @@ -44,4 +47,4 @@ fun GreetingPreview() {
ZiineTheme {
Greeting("Android")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ val Pink80 = Color(0xFFEFB8C8)

val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260)
val Pink40 = Color(0xFF7D5260)
44 changes: 23 additions & 21 deletions app/src/main/java/com/nexters/ziine/android/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext

private val DarkColorScheme = darkColorScheme(
primary = Purple80,
secondary = PurpleGrey80,
tertiary = Pink80
)

private val LightColorScheme = lightColorScheme(
primary = Purple40,
secondary = PurpleGrey40,
tertiary = Pink40
private val DarkColorScheme =
darkColorScheme(
primary = Purple80,
secondary = PurpleGrey80,
tertiary = Pink80
)

private val LightColorScheme =
lightColorScheme(
primary = Purple40,
secondary = PurpleGrey40,
tertiary = Pink40
/* Other default colors to override
background = Color(0xFFFFFBFE),
surface = Color(0xFFFFFBFE),
Expand All @@ -29,8 +30,8 @@ private val LightColorScheme = lightColorScheme(
onTertiary = Color.White,
onBackground = Color(0xFF1C1B1F),
onSurface = Color(0xFF1C1B1F),
*/
)
*/
)

@Composable
fun ZiineTheme(
Expand All @@ -39,19 +40,20 @@ fun ZiineTheme(
dynamicColor: Boolean = true,
content: @Composable () -> Unit
) {
val colorScheme = when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}
val colorScheme =
when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}

darkTheme -> DarkColorScheme
else -> LightColorScheme
}
darkTheme -> DarkColorScheme
else -> LightColorScheme
}

MaterialTheme(
colorScheme = colorScheme,
typography = Typography,
content = content
)
}
}
22 changes: 12 additions & 10 deletions app/src/main/java/com/nexters/ziine/android/ui/theme/Type.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp

// Set of Material typography styles to start with
val Typography = Typography(
bodyLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.5.sp
)
val Typography =
Typography(
bodyLarge =
TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.5.sp
)
/* Other default text styles to override
titleLarge = TextStyle(
fontFamily = FontFamily.Default,
Expand All @@ -30,5 +32,5 @@ val Typography = Typography(
lineHeight = 16.sp,
letterSpacing = 0.5.sp
)
*/
)
*/
)
16 changes: 1 addition & 15 deletions app/src/test/java/com/nexters/ziine/android/ExampleUnitTest.kt
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
package com.nexters.ziine.android

import org.junit.Test

import org.junit.Assert.*

/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
class ExampleUnitTest
7 changes: 6 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ plugins {
alias(libs.plugins.google.service) apply false
alias(libs.plugins.firebase.crashlytics) apply false
alias(libs.plugins.ksp) apply false
}
alias(libs.plugins.ktlint) apply false
}

allprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint")
}
6 changes: 6 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ landscapist = "2.3.6"
javax-inject = "1"
firebase-bom = "33.8.0"
firebase-crashlytics = "3.0.2"
kotlinx-serialization-converter = "1.0.0"

# test
test-kotest = "5.8.1"

#ktlint
ktlint = "12.1.2"

[libraries]

# kotlin
Expand Down Expand Up @@ -126,3 +130,5 @@ hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }

firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebase-crashlytics" }

ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
1 change: 0 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ dependencyResolutionManagement {

rootProject.name = "ziine-android"
include(":app")