cortinico / ktfmt-gradle

A Gradle plugin to apply ktfmt to your builds, and reformat you Kotlin source code like a glimpse ๐Ÿงน๐Ÿ˜
MIT License
149 stars 20 forks source link

add option to skip ktfmtCheck #282

Open jillesvangurp opened 4 months ago

jillesvangurp commented 4 months ago

โš ๏ธ Is your feature request related to a problem? Please describe

I'm dealing with way too much formatting related build failures since introducing this plugin and just disabled it for that reason.

๐Ÿ’ก Describe the solution you'd like

I like it to just format my code without whining about it. I don't want my work flow interrupted over minor formatting issues. ktfmtCheck should be optional. I don't want it to check, I want it to fix. I would like to specify in either gradle.properties or the ktfmt dsl block that it should skip any and all formatting checks when running builds.

If that's already possible, it's not clear from the documentation.

๐Ÿคš Do you want to develop this feature yourself?

cortinico commented 4 months ago

Yup this is something we can add to the plugin. Practically we want to make this section optional: https://github.com/cortinico/ktfmt-gradle/blob/ecda8fb1ca3e1414f2337ae2de97340425cbc7f1/plugin-build/plugin/src/main/java/com/ncorti/ktfmt/gradle/KtfmtPluginUtils.kt#L57-L61

simonhauck commented 2 months ago

As a temporary workaround you could also do something like this

tasks.withType<KtfmtCheckTask>() { enabled = false }