mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
feat(jetbrains): add detekt for cyclomatic complexity and file size limits
Adds detekt static analysis to enforce complexity and file size caps in kilo-jetbrains, mirroring the ESLint complexity/max-lines rules used by the VS Code extension.
This commit is contained in:
@@ -9,6 +9,7 @@ plugins {
|
||||
application
|
||||
id("java")
|
||||
alias(libs.plugins.intellij.platform)
|
||||
alias(libs.plugins.detekt)
|
||||
|
||||
alias(libs.plugins.kotlin) apply false
|
||||
alias(libs.plugins.kotlin.serialization) apply false
|
||||
@@ -17,6 +18,19 @@ plugins {
|
||||
|
||||
subprojects {
|
||||
apply(plugin = "org.jetbrains.intellij.platform.module")
|
||||
apply(plugin = "io.gitlab.arturbosch.detekt")
|
||||
|
||||
detekt {
|
||||
config.setFrom(rootProject.file("detekt.yml"))
|
||||
buildUponDefaultConfig = true
|
||||
source.setFrom("src/main/kotlin")
|
||||
}
|
||||
}
|
||||
|
||||
detekt {
|
||||
config.setFrom(file("detekt.yml"))
|
||||
buildUponDefaultConfig = true
|
||||
source.setFrom("src/main/kotlin")
|
||||
}
|
||||
|
||||
allprojects {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
# Detekt configuration for kilo-jetbrains.
|
||||
#
|
||||
# Enforces file size and cyclomatic complexity limits — the Kotlin
|
||||
# equivalent of the ESLint complexity/max-lines rules used by the
|
||||
# VS Code extension (packages/kilo-vscode/eslint.config.mjs).
|
||||
#
|
||||
# New code must stay within the default limits. Do not raise these
|
||||
# caps; refactor instead.
|
||||
|
||||
complexity:
|
||||
CyclomaticComplexMethod:
|
||||
active: true
|
||||
threshold: 15
|
||||
LongMethod:
|
||||
active: true
|
||||
threshold: 60
|
||||
LargeClass:
|
||||
active: true
|
||||
threshold: 600
|
||||
TooManyFunctions:
|
||||
active: true
|
||||
threshold: 15
|
||||
ComplexCondition:
|
||||
active: true
|
||||
threshold: 4
|
||||
LongParameterList:
|
||||
active: false
|
||||
NestedBlockDepth:
|
||||
active: true
|
||||
threshold: 4
|
||||
@@ -7,6 +7,7 @@ kotlin-serialization-plugin = "2.1.20"
|
||||
kotlin-serialization = "1.8.1"
|
||||
okhttp = "4.12.0"
|
||||
openapi-generator = "7.21.0"
|
||||
detekt = "1.23.8"
|
||||
|
||||
[libraries]
|
||||
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
|
||||
@@ -16,6 +17,7 @@ kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serializa
|
||||
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version = "1.10.2" }
|
||||
|
||||
[plugins]
|
||||
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
|
||||
intellij-platform = { id = "org.jetbrains.intellij.platform", version.ref = "intellij-gradle-plugin" }
|
||||
rpc = { id = "rpc", version.ref = "intellij-rpc-plugin" }
|
||||
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin-jvm-plugin" }
|
||||
|
||||
Reference in New Issue
Block a user