val ktlint by configurations.creating repositories { jcenter() } dependencies { ktlint("com.pinterest:ktlint:0.40.0") } val outputDir = "${project.buildDir}/reports/ktlint/" val inputFiles = project.fileTree(mapOf("dir" to "src", "include" to "**/*.kt")) val ktlintCheck by tasks.creating(JavaExec::class) { inputs.files(inputFiles) outputs.dir(outputDir) description = "Check Kotlin code style." classpath = ktlint main = "com.pinterest.ktlint.Main" args = listOf("src/**/*.kt") } val ktlintFormat by tasks.creating(JavaExec::class) { inputs.files(inputFiles) outputs.dir(outputDir) description = "Fix Kotlin code style deviations." classpath = ktlint main = "com.pinterest.ktlint.Main" args = listOf("-F", "src/**/*.kt") }