Skip to content

Instantly share code, notes, and snippets.

@photizzo
Created June 10, 2019 10:46
Show Gist options
  • Save photizzo/a5a22cb2c4d280fb706fd4234707c1c2 to your computer and use it in GitHub Desktop.
Save photizzo/a5a22cb2c4d280fb706fd4234707c1c2 to your computer and use it in GitHub Desktop.
repositories {
jcenter()
}
configurations {
ktlint
}
dependencies {
ktlint "com.pinterest:ktlint:0.33.0"
// 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"
// to generate report in checkstyle format prepend following args:
// "--reporter=plain", "--reporter=checkstyle,output=${buildDir}/ktlint.xml"
// see https://github.com/pinterest/ktlint#usage for more
}
check.dependsOn ktlint
task ktlintFormat(type: JavaExec, group: "formatting") {
description = "Fix Kotlin code style deviations."
classpath = configurations.ktlint
main = "com.pinterest.ktlint.Main"
args "-F", "src/**/*.kt"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment