-
Notifications
You must be signed in to change notification settings - Fork 5
/
ktlint.gradle
30 lines (26 loc) · 1.05 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
// Source: https://github.com/shyiko/ktlint#without-a-plugin
//
// kotlin-gradle-plugin must be applied for configuration below to work
// (see https://kotlinlang.org/docs/reference/using-gradle.html)
configurations {
ktlint
}
dependencies {
ktlint "com.pinterest:ktlint:0.42.1"
// 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
}
task ktlint(type: JavaExec, group: "verification") {
description = "Check Kotlin code style."
classpath = configurations.ktlint
main = "com.pinterest.ktlint.Main"
args "src/**/*.kt", "--reporter=plain", "--disabled_rules=import-ordering", "--reporter=checkstyle,output=${buildDir}/reports/ktlint.xml"
standardOutput = System.err
}
task ktlintFormat(type: JavaExec, group: "formatting") {
description = "Fix Kotlin code style deviations."
classpath = configurations.ktlint
main = "com.pinterest.ktlint.Main"
args "-F", "src/**/*.kt", "--disabled_rules=import-ordering"
}