Build: enable ktlint+detekt, format sources, add core unit tests
This commit is contained in:
@@ -13,4 +13,6 @@ dependencies {
|
||||
implementation(libs.kotlinAllopenPlugin)
|
||||
implementation(libs.kotlinNoargPlugin)
|
||||
implementation(libs.springBootGradlePlugin)
|
||||
implementation(libs.ktlintGradlePlugin)
|
||||
implementation(libs.detektGradlePlugin)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ dependencyResolutionManagement {
|
||||
@Suppress("UnstableApiUsage")
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
// Reuse the version catalog from the main build.
|
||||
|
||||
34
buildSrc/src/main/kotlin/lms.lint.gradle.kts
Normal file
34
buildSrc/src/main/kotlin/lms.lint.gradle.kts
Normal file
@@ -0,0 +1,34 @@
|
||||
// Единая конфигурация статического анализа Kotlin: ktlint (формат) + detekt (качество).
|
||||
// На время миграции ignoreFailures=true — задачи только отчитываются, не ломая сборку.
|
||||
import io.gitlab.arturbosch.detekt.Detekt
|
||||
|
||||
plugins {
|
||||
id("org.jlleitschuh.gradle.ktlint")
|
||||
id("io.gitlab.arturbosch.detekt")
|
||||
}
|
||||
|
||||
ktlint {
|
||||
ignoreFailures.set(true)
|
||||
filter {
|
||||
exclude("**/build/**")
|
||||
}
|
||||
}
|
||||
|
||||
detekt {
|
||||
buildUponDefaultConfig = true
|
||||
config.setFrom(rootProject.files("config/detekt/detekt.yml"))
|
||||
ignoreFailures = true
|
||||
parallel = true
|
||||
}
|
||||
|
||||
tasks.withType<Detekt>().configureEach {
|
||||
jvmTarget = "21"
|
||||
exclude("**/build/**")
|
||||
reports {
|
||||
html.required.set(true)
|
||||
xml.required.set(false)
|
||||
txt.required.set(false)
|
||||
sarif.required.set(false)
|
||||
md.required.set(false)
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ plugins {
|
||||
id("org.jetbrains.kotlin.plugin.spring")
|
||||
id("org.jetbrains.kotlin.plugin.jpa")
|
||||
id("org.springframework.boot")
|
||||
id("lms.lint")
|
||||
}
|
||||
|
||||
group = "ru.ysu.lms"
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.kotlin.plugin.spring")
|
||||
id("lms.lint")
|
||||
}
|
||||
|
||||
group = "ru.ysu.lms"
|
||||
|
||||
Reference in New Issue
Block a user