forked from saveourtool/diktat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
50 lines (39 loc) · 1.38 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
val ktlint by configurations.creating
repositories {
// artipie - an open source project that is used to store ktlint and diktat dependencies
maven {
url = uri("https://central.artipie.com/akuleshov7/diktat")
}
mavenCentral()
jcenter()
}
dependencies {
ktlint("com.pinterest:ktlint:0.37.1-fork") {
// need to exclude standard ruleset to use only diktat rules
exclude("com.pinterest.ktlint", "ktlint-ruleset-standard")
}
// diktat ruleset
ktlint("org.cqfn.diktat:diktat-rules:1.0.1") {
exclude("org.slf4j", "slf4j-log4j12")
}
}
val outputDir = "${project.buildDir}/reports/diktat/"
val inputFiles = project.fileTree(mapOf("dir" to "src", "include" to "**/*.kt"))
val diktatCheck by tasks.creating(JavaExec::class) {
inputs.files(inputFiles)
outputs.dir(outputDir)
description = "Check Kotlin code style."
classpath = ktlint
main = "com.pinterest.ktlint.Main"
// specify proper path to sources that should be checked here
args = listOf("src/main/kotlin/**/*.kt")
}
val diktatFormat by tasks.creating(JavaExec::class) {
inputs.files(inputFiles)
outputs.dir(outputDir)
description = "Fix Kotlin code style deviations."
classpath = ktlint
main = "com.pinterest.ktlint.Main"
// specify proper path to sources that should be checked here
args = listOf("-F", "src/main/kotlin/**/*.kt")
}