diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 8aedca9f..c7ed8ad2 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -133,6 +133,9 @@ android {
detekt {
baseline = file("detekt-baseline.xml")
+ config.setFrom("$rootDir/detekt.yml")
+ buildUponDefaultConfig = true
+ allRules = false
}
dependencies {
@@ -142,4 +145,5 @@ dependencies {
implementation(libs.bundles.room)
ksp(libs.androidx.room.compiler)
+ detektPlugins(libs.compose.detekt)
}
diff --git a/app/detekt-baseline.xml b/app/detekt-baseline.xml
index 99ae383f..13776401 100644
--- a/app/detekt-baseline.xml
+++ b/app/detekt-baseline.xml
@@ -22,18 +22,9 @@
EmptyFunctionBlock:ClipsActivityAdapter.kt$ClipsActivityAdapter${}
ForbiddenComment:SimpleKeyboardIME.kt$SimpleKeyboardIME$// TODO: Change keyboardMode to enum class
LargeClass:MyKeyboardView.kt$MyKeyboardView : View
- LongMethod:Context.kt$fun Context.setupKeyboardDialogStuff( windowToken: IBinder, view: View, dialog: AlertDialog.Builder, titleId: Int = 0, titleText: String = "", cancelOnTouchOutside: Boolean = true, callback: ((alertDialog: AlertDialog) -> Unit)? = null )
- LongMethod:MyKeyboard.kt$MyKeyboard$@SuppressLint("UseCompatLoadingForDrawables") private fun loadKeyboard(context: Context, parser: XmlResourceParser)
LongMethod:MyKeyboardView.kt$MyKeyboardView$@SuppressLint("UseCompatLoadingForDrawables") private fun onBufferDraw()
- LongMethod:MyKeyboardView.kt$MyKeyboardView$fun setKeyboardHolder(binding: KeyboardViewKeyboardBinding)
- LongMethod:MyKeyboardView.kt$MyKeyboardView$fun setupKeyboard(changedView: View? = null)
- LongMethod:MyKeyboardView.kt$MyKeyboardView$override fun onTouchEvent(me: MotionEvent): Boolean
- LongMethod:MyKeyboardView.kt$MyKeyboardView$private fun onLongPress(popupKey: MyKeyboard.Key, me: MotionEvent): Boolean
LongMethod:MyKeyboardView.kt$MyKeyboardView$private fun onModifiedTouchEvent(me: MotionEvent): Boolean
- LongMethod:MyKeyboardView.kt$MyKeyboardView$private fun setupEmojiAdapter(emojis: List<EmojiData>)
- LongMethod:MyKeyboardView.kt$MyKeyboardView$private fun showKey(keyIndex: Int)
LongMethod:SimpleKeyboardIME.kt$SimpleKeyboardIME$override fun onKey(code: Int)
- LongParameterList:Context.kt$( windowToken: IBinder, view: View, dialog: AlertDialog.Builder, titleId: Int = 0, titleText: String = "", cancelOnTouchOutside: Boolean = true, callback: ((alertDialog: AlertDialog) -> Unit)? = null )
LoopWithTooManyJumpStatements:MyKeyboard.kt$MyKeyboard$while
MagicNumber:Config.kt$Config$100
MagicNumber:EmojiHelper.kt$3
diff --git a/app/lint-baseline.xml b/app/lint-baseline.xml
index 5faa372f..4c58bc87 100644
--- a/app/lint-baseline.xml
+++ b/app/lint-baseline.xml
@@ -25,8 +25,8 @@
errorLine1="app-build-targetSDK = "34""
errorLine2=" ~~~~">
@@ -47,7 +47,7 @@
errorLine1="distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
@@ -58,19 +58,30 @@
errorLine1="gradlePlugins-agp = "8.10.1""
errorLine2=" ~~~~~~~~">
+
+
+
+
diff --git a/detekt.yml b/detekt.yml
new file mode 100644
index 00000000..6472c5a3
--- /dev/null
+++ b/detekt.yml
@@ -0,0 +1,58 @@
+build:
+ maxIssues: 0
+ weights:
+ complexity: 2
+ LongParameterList: 2
+ style: 1
+
+processors:
+ active: true
+ exclude:
+ - "FunctionCountProcessor"
+ - "PropertyCountProcessor"
+
+config:
+ validation: true
+
+complexity:
+ LongParameterList:
+ active: true
+ functionThreshold: 10
+ constructorThreshold: 8
+ ignoreDefaultParameters: true
+ ignoreAnnotated:
+ - "Composable"
+ LongMethod:
+ active: true
+ threshold: 120
+ ignoreAnnotated:
+ - "Composable"
+ - "Preview"
+
+style:
+ MagicNumber:
+ active: true
+ ignoreAnnotated: ["Composable"]
+ ignoreEnums: true
+ ignoreNumbers: ["-1", "0", "1", "2", "42", "1000"]
+ MaxLineLength:
+ active: true
+ maxLineLength: 120
+ excludePackageStatements: true
+ excludeImportStatements: true
+
+naming:
+ FunctionNaming:
+ active: true
+ ignoreAnnotated: ["Composable", "Preview"]
+ functionPattern: "[a-z][A-Za-z0-9]*"
+
+Compose: # io.nlopez.compose.rules
+ ComposableParametersOrdering:
+ active: true
+ ModifierDefaultValue:
+ active: true
+ MissingModifierDefaultValue:
+ active: true
+ PublicComposablePreview:
+ active: true
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index d2c9f54d..c8bc556c 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -8,6 +8,7 @@ androidx-emoji2 = "1.5.0"
ksp = "2.1.21-2.0.2"
#Detekt
detekt = "1.23.8"
+detektCompose = "0.4.22"
#Room
room = "2.7.2"
#Fossify
@@ -28,6 +29,8 @@ androidx-emoji2-bundled = { module = "androidx.emoji2:emoji2-bundled", version.r
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" }
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "room" }
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" }
+#Compose
+compose-detekt = { module = "io.nlopez.compose.rules:detekt", version.ref = "detektCompose" }
#Fossify
fossify-commons = { module = "org.fossify:commons", version.ref = "commons" }
[bundles]
diff --git a/lint.xml b/lint.xml
index 05685cd8..4b4a7825 100644
--- a/lint.xml
+++ b/lint.xml
@@ -31,4 +31,5 @@
+