-
Notifications
You must be signed in to change notification settings - Fork 2
/
ktlint.gradle
33 lines (30 loc) · 1.17 KB
/
ktlint.gradle
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
configurations {
ktlint
}
dependencies {
ktlint(libs.ktlint.cli) {
attributes {
attribute(Bundling.BUNDLING_ATTRIBUTE, getObjects().named(Bundling, Bundling.EXTERNAL))
}
}
// additional 3rd party ruleset(s) can be specified here
// just add them to the classpath (e.g. ktlint 'groupId:artifactId:version') and
// ktlint will pick them up
}
tasks.register("ktlintCheck", JavaExec) {
group = "verification"
description = "Check Kotlin code style."
classpath = configurations.ktlint
mainClass = "com.pinterest.ktlint.Main"
// see https://pinterest.github.io/ktlint/install/cli/#command-line-usage for more information
args "src/**/*.kt", "buildSrc/**/*.kt", "**.kts", "!**/build/**"
}
tasks.register("ktlintFormat", JavaExec) {
group = "formatting"
description = "Fix Kotlin code style deviations."
classpath = configurations.ktlint
mainClass = "com.pinterest.ktlint.Main"
jvmArgs "--add-opens=java.base/java.lang=ALL-UNNAMED"
// see https://pinterest.github.io/ktlint/install/cli/#command-line-usage for more information
args "-F", "src/**/*.kt", "buildSrc/**/*.kt", "**.kts", "!**/build/**"
}