I see from the docs that detekt can validate forma...
# detekt
b
I see from the docs that detekt can validate formatting via ktlint, but can it also format files with it?
g
Yes we do have the autoCorrect flag exactly for that
b
What would gradle cmdline look like for this?
j
when I was using detekt with the autoformatting, I think just running detekt was autoformatting everything, but not sure, that was long time ago
hope ktfmt being integrated into detekt tho 🙂
b
Oh? Is there a way to separate out formatting and checking?
j
not sure tbh, that was long time ago
g
The gradle cmq line for autocorrect will be
--auto-correct
but will be available in Detekt 1.19.0 (the next release).
K 1
b
Btw, I've always been curious how custon cli args are implemented in gradle. Could you point me to some code?
g
b
Wow, can't believe how simple this is
😃 1
j
--auto-correct
works so because it is a boolean, if it was an string, I think it was
--some-task-prop=someString
That was the reason I moved the kamp implementation to Gradle tasks hahah, it was easier to use
b
Ah, just read in gradle docs today that
=
is recommended, but optional
j
--auto-correct if the variable is a boolean set it as true
but if the variable is a string you need to indicate the value, so you need the equals I think
or you mean you can add an space?
Copy code
--some-task-prop someString // this?
I havent tried it tbh
b
I meant
--my-option="value"
is understood as identical to
--my-option "value"
by gradle
j
interesting, TIL
b
But gradle recommends using
=
. Maybe they have plans to make it mandatory in the future 🤷