Skip to content

Commit e4c8032

Browse files
committed
build/qg-xxx: в проект добавлен detekt
1 parent 911c211 commit e4c8032

File tree

5 files changed

+47
-5
lines changed

5 files changed

+47
-5
lines changed

app/build.gradle.kts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,15 @@ gitProperties {
209209
} else {
210210
this.dotGitDirectory.set(dotGit)
211211
}
212-
}
212+
}
213+
214+
// см. https://detekt.dev/docs/gettingstarted/gradle/#dependencies
215+
// https://github.com/detekt/detekt/issues/7384
216+
configurations.matching { it.name == "detekt" }.all {
217+
resolutionStrategy.eachDependency {
218+
if (requested.group == "org.jetbrains.kotlin") {
219+
@Suppress("UnstableApiUsage")
220+
useVersion(io.gitlab.arturbosch.detekt.getSupportedKotlinVersion())
221+
}
222+
}
223+
}

app/src/test/kotlin/pro/qyoga/tests/cases/app/therapist/appointments/core/SchedulePageTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import io.kotest.matchers.shouldBe
66
import org.junit.jupiter.api.DisplayName
77
import org.junit.jupiter.api.Test
88
import pro.azhidkov.platform.spring.sdj.ergo.hydration.ref
9-
import pro.qyoga.core.appointments.core.model.AppointmentStatus
109
import pro.qyoga.core.calendar.ical.model.ICalCalendarItem
1110
import pro.qyoga.tests.assertions.shouldBePage
1211
import pro.qyoga.tests.clients.TherapistClient
@@ -21,7 +20,6 @@ import pro.qyoga.tests.pages.therapist.appointments.CalendarPage
2120
import pro.qyoga.tests.pages.therapist.appointments.appointmentCards
2221
import pro.qyoga.tests.pages.therapist.appointments.shouldMatch
2322
import pro.qyoga.tests.platform.instancio.KSelect.Companion.field
24-
import java.time.Duration
2523
import java.time.LocalDate
2624

2725

build.gradle.kts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ plugins {
55
alias(libs.plugins.kotlin) apply false
66
alias(libs.plugins.spring.dependencyManagement) apply false
77
alias(libs.plugins.spring.boot) apply false
8+
alias(libs.plugins.detekt) apply false
89
}
910

1011
// Почему-то внутри subprojects libs не доступен
11-
val kotlinPlugin = libs.plugins.kotlin.asProvider().get().pluginId
12+
val kotlinPlugin = libs.plugins.kotlin.asProvider().get()
13+
val detektPlugin = libs.plugins.detekt.get()
1214

1315
subprojects {
14-
apply(plugin = kotlinPlugin)
16+
apply(plugin = kotlinPlugin.pluginId)
17+
apply(plugin = detektPlugin.pluginId)
1518

1619
repositories {
1720
mavenCentral()
@@ -23,6 +26,13 @@ subprojects {
2326
}
2427
}
2528

29+
configure<io.gitlab.arturbosch.detekt.extensions.DetektExtension> {
30+
toolVersion = detektPlugin.version.requiredVersion
31+
32+
config.setFrom(file(rootProject.rootDir.resolve("config/detekt/detekt.yml")))
33+
buildUponDefaultConfig = false
34+
}
35+
2636
tasks.withType<KotlinCompile> {
2737
compilerOptions {
2838
freeCompilerArgs = listOf("-Xjsr305=strict", "-Xjvm-default=all", "-Xwhen-guards")

config/detekt/detekt.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
build:
2+
maxIssues: 0
3+
excludeCorrectable: false
4+
weights:
5+
# complexity: 2
6+
# LongParameterList: 1
7+
# style: 1
8+
# comments: 1
9+
10+
style:
11+
UnusedImports:
12+
active: true
13+
UnusedPrivateClass:
14+
active: true
15+
UnusedPrivateMember:
16+
active: true
17+
18+
complexity:
19+
CognitiveComplexMethod:
20+
active: true
21+
threshold: 15

settings.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dependencyResolutionManagement {
1111
val springDependencyManagementVersion = version("springDependencyManagement", "1.1.7")
1212
val koverVersion = version("kover", "0.9.1")
1313
val gitPropertiesVersion = version("gitProperties", "2.5.0")
14+
val detektVersion = version("dekekt", "1.23.8")
1415

1516
// lib versions
1617
val poiVersion = version("poi", "5.4.1")
@@ -26,6 +27,7 @@ dependencyResolutionManagement {
2627

2728
plugin("kover", "org.jetbrains.kotlinx.kover").versionRef(koverVersion)
2829
plugin("gitProperties", "com.gorylenko.gradle-git-properties").versionRef(gitPropertiesVersion)
30+
plugin("detekt", "io.gitlab.arturbosch.detekt").versionRef(detektVersion)
2931

3032
// libs
3133
library("jackarta-validation", "jakarta.validation", "jakarta.validation-api").version("3.1.1")

0 commit comments

Comments
 (0)