Skip to content
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
3 changes: 3 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
- name: Run ktlint
run: ./gradlew ktlintCheck

- name: Run detekt
run: ./gradlew detekt

- name: Build with Gradle
run: ./gradlew build

Expand Down
1 change: 1 addition & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ dependencies {
implementation(libs.hilt.gradlePlugin)
implementation(libs.ksp.gradlePlugin)
implementation(libs.compose.compiler.gradlePlugin)
implementation(libs.detekt.gradlePlugin)
}
14 changes: 14 additions & 0 deletions build-logic/src/main/kotlin/com/chat/build_logic/VerifyDetekt.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.chat.build_logic

import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies

internal fun Project.configureVerifyDetekt() {
with(pluginManager) {
apply("io.gitlab.arturbosch.detekt")
}

dependencies {
"detektPlugins"(libs.findLibrary("detekt.formatting").get())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import com.chat.build_logic.configureKotlinAndroid
plugins {
id("com.android.library")
kotlin("android")
id("convention.verify.detekt")
}

android {
Expand Down
13 changes: 13 additions & 0 deletions build-logic/src/main/kotlin/convention.verify.detekt.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import com.chat.build_logic.configureVerifyDetekt
import io.gitlab.arturbosch.detekt.Detekt

configureVerifyDetekt()

tasks.withType<Detekt>().configureEach {
jvmTarget = "17"

buildUponDefaultConfig = true // 기본 설정에서 추가 설정만 덮어쓰기
allRules = false // 모든 룰을 활성화 할지 설정
parallel = true // 코드 분석 병렬 실행 설정
config = files("$rootDir/config/detekt/detekt.yml")
}
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ plugins {
alias(libs.plugins.android.test) apply false
alias(libs.plugins.baselineprofile) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.detekt) apply false
}

allprojects {
Expand Down
124 changes: 124 additions & 0 deletions config/detekt/detekt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
build:
maxIssues: 0

config:
validation: true
warningsAsErrors: true

complexity:
active: true
ComplexCondition: # 복잡한 조건 설정
active: true
threshold: 5
ComplexInterface: # 많은 함수 및 속성을 포함하는 인터페이스
active: true
threshold: 10
includeStaticDeclarations: false
includePrivateDeclarations: false
CyclomaticComplexMethod: # 독립적 경로의 수가 많은 복잡한 메서드 설정
active: true
threshold: 50
ignoreSingleWhenExpression: false # when 표현식 하나인 메서드 무시
ignoreSimpleWhenEntries: false # 간단한 항목(중괄호 없음)을 무시
ignoreNestingFunctions: false # if 나 for 문 대신 자주 사용되는 함수 무시
nestingFunctions:
- 'also'
- 'apply'
- 'forEach'
- 'isNotNull'
- 'ifNull'
- 'let'
- 'run'
- 'use'
- 'with'
LargeClass: # 큰 클래스 크기 설정
active: true
threshold: 500
LongMethod: # 긴 메서드 크기 설정
active: true
threshold: 400
LongParameterList: # 특정 임계값보다 많은 매개변수가 있는 함수와 생성자
active: true
functionThreshold: 20
constructorThreshold: 7
ignoreDefaultParameters: false # 기본값이 있는 매개변수 포함
ignoreDataClasses: true # 데이터 클래스에 대해서 무시
TooManyFunctions:
active: true
thresholdInFiles: 30
thresholdInClasses: 20
thresholdInInterfaces: 10
thresholdInObjects: 20
thresholdInEnums: 5
ignoreDeprecated: true # @Deprecated 함수를 카운트에서 제외
ignorePrivate: true # private 접근 제어자 함수를 카운트에서 제외
ignoreOverridden: false # 오버라이드한 함수를 카운트에 포함
NestedBlockDepth: # 중첩된 코드 블록
active: true
threshold: 10

coroutines:
active: true
GlobalCoroutineUsage:
active: false
RedundantSuspendModifier:
active: false
SleepInsteadOfDelay:
active: false
SuspendFunWithFlowReturnType:
active: false

empty-blocks:
active: true

exceptions:
active: true
InstanceOfCheckForException: # 예외 유형을 검사하는 catch 블록
active: false
TooGenericExceptionThrown: # 너무 일반적인 유형의 Exception
active: false
exceptionNames:
- 'Error'
- 'Exception'
- 'RuntimeException'
- 'Throwable'

formatting:
active: true
ImportOrdering:
active: false
MaximumLineLength:
active: true
maxLineLength: 160
ArgumentListWrapping:
active: false
Wrapping:
active: false
PackageName:
active: false

naming:
active: true
ConstructorParameterNaming: # 지정된 명명 규칙을 따르지 않는 생성자 매개변수
active: false
FunctionNaming: # 지정된 명명 규칙을 따르지 않는 함수 이름
active: false
BooleanPropertyNaming:
active: true
NonBooleanPropertyPrefixedWithIs:
active: true
PackageNaming:
active: false

performance:
active: true
ForEachOnRange: # 성능 비용이 발생하는 forEach 구문
active: false
SpreadOperator: # 성능 저하 발생하는 spread 연산자
active: false

potential-bugs:
active: true

style:
active: false
5 changes: 2 additions & 3 deletions core/data/src/test/java/com/chat/data/ExampleUnitTest.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.chat.data

import org.junit.Test

import org.junit.Assert.*
import org.junit.Assert.assertEquals

/**
* Example local unit test, which will execute on the development machine (host).
Expand All @@ -14,4 +13,4 @@ class ExampleUnitTest {
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ fun DetailAppbar(
@Composable
fun DetailAppbarPreview() {
DetailAppbar()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ fun GoSocketAppbarPreview() {
) {
Text(text = "GoSocketAppbar")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ fun MainAppbar(
@Composable
fun MainAppbarPreview() {
MainAppbar()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ fun CreateMessageBottomSheetPreview() {
Text(text = "Open")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ fun GoSocketBottomSheet(
val bottomSheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)
val insets = ViewCompat.getRootWindowInsets(LocalView.current)
val context = LocalView.current.context
val navigationBarHeight = insets?.getInsets(WindowInsetsCompat.Type.navigationBars())?.bottom?.toDp(context)?.dp ?: 0.dp
val navigationBarHeight =
insets?.getInsets(WindowInsetsCompat.Type.navigationBars())?.bottom?.toDp(context)?.dp
?: 0.dp

ModalBottomSheet(
sheetState = bottomSheetState,
Expand All @@ -56,7 +58,14 @@ fun GoSocketBottomSheet(
},
onDismissRequest = onDismissRequest,
) {
Column(modifier = modifier.padding(start = 10.dp, top = 6.dp, end = 10.dp, bottom = 14.dp + navigationBarHeight)) {
Column(
modifier = modifier.padding(
start = 10.dp,
top = 6.dp,
end = 10.dp,
bottom = 14.dp + navigationBarHeight
)
) {
content()
}
}
Expand All @@ -82,4 +91,4 @@ fun GoSocketBottomSheetPreview() {
Text(text = "Open")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ fun GoSocketButtonPreview() {
onClick = {}
) { IcCreateDirectMessage(modifier = Modifier.size(22.dp, 18.dp), tint = Color.White) }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ fun GoSocketFloatingActionButton(
@Composable
fun GoSocketFloatingActionButtonPreview() {
GoSocketFloatingActionButton {}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ fun GoSocketOutlinedButtonPreview() {
text = "GoSocketOutlinedButton"
) {}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ fun InviteFriendButton(
@Composable
fun InviteFriendButtonPreview() {
InviteFriendButton {}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fun GoSocketCheckbox(
.clip(RoundedCornerShape(8.dp))
.border(
width = 2.dp,
color = if (isChecked) P1 else N3,
color = if (isChecked) P1 else N3,
shape = RoundedCornerShape(8.dp)
)
.clickableNoRipple {
Expand All @@ -56,4 +56,4 @@ fun GoSocketCheckboxPreview() {
Spacer(modifier = Modifier.height(10.dp))
GoSocketCheckbox(checked = false) {}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@ fun GoSocketDialogPreview() {
)
Spacer(modifier = Modifier.height(30.dp))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ fun InviteDialog(
@Composable
fun InviteDialogPreview() {
InviteDialog()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fun GoSocketBottomNavigationBar(modifier: Modifier = Modifier) {
selected = selectedIndex == it,
onClick = { selectedIndex = it },
icon = {
when(it) {
when (it) {
0 -> IcHome(modifier = Modifier.size(30.dp), tint = if (selectedIndex == it) Color(0xFF6263FB) else Color(0xFF848484))
1 -> IcDirectMessage(modifier = Modifier.size(30.dp), tint = if (selectedIndex == it) Color(0xFF6263FB) else Color(0xFF848484))
2 -> IcSpace(modifier = Modifier.size(30.dp), tint = if (selectedIndex == it) Color(0xFF6263FB) else Color(0xFF848484))
Expand All @@ -52,4 +52,4 @@ fun GoSocketBottomNavigationBar(modifier: Modifier = Modifier) {
@Composable
fun GoSocketBottomNavigationBarPreview() {
GoSocketBottomNavigationBar()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ fun GoSocketProgressbar(
@Composable
fun GoSocketProgressbarPreview() {
GoSocketProgressbar(progress = 0.33f)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicTextField
Expand Down Expand Up @@ -95,4 +94,4 @@ fun GoSocketTextFieldPreview() {
leadingIcon = { IcSearch(modifier = Modifier.padding(end = 8.dp), tint = it) },
trailingIcon = { IcSend(tint = it) },
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ fun InviteTextField(modifier: Modifier = Modifier) {
@Composable
fun InviteTextFieldPreview() {
InviteTextField()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ fun MessageTextField(
@Composable
fun MessageTextFieldPreview() {
MessageTextField()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ fun SearchTextField(
@Composable
fun SearchTextFieldPreview() {
SearchTextField()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import androidx.compose.ui.graphics.Color
val P1 = Color(0xFF6263FB)

val N3 = Color(0xFFBBBBCC)
val N4 = Color(0xFFE2E2EE)
val N4 = Color(0xFFE2E2EE)
Loading
Loading