Created
November 19, 2018 04:26
-
-
Save toidv/73669640f90aab476f4585b668e27257 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
configurations { | |
ktlint | |
} | |
dependencies { | |
ktlint "com.github.shyiko:ktlint:$KTLINT_VERSION" | |
} | |
task ktlint(type: JavaExec, group: "verification") { | |
description = "Check Kotlin code style." | |
classpath = configurations.ktlint | |
main = "com.github.shyiko.ktlint.Main" | |
args "src/**/*.kt", "--reporter=checkstyle" | |
def outputDirectory = "$buildDir/reports/ktlint" | |
def outputFile = "${outputDirectory}/ktlint-checkstyle-report.xml" | |
ignoreExitValue = true | |
doFirst { | |
new File(outputDirectory).mkdirs() | |
standardOutput = new FileOutputStream(outputFile) | |
} | |
} | |
check.dependsOn ktlint | |
task ktlintFormat(type: JavaExec, group: "formatting") { | |
description = "Fix Kotlin code style deviations." | |
classpath = configurations.ktlint | |
main = "com.github.shyiko.ktlint.Main" | |
args "-F", "src/**/*.kt" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment