Is it possible tu use detekt as formatter instead ...
# detekt
b
Is it possible tu use detekt as formatter instead of ktlint?
c
I assume you mean to auto-correct code in case of violation.
The answer would be not as of today, the only auto-correction are performed by
detekt-formatting
, which wraps around
ktlint
b
Well general formatting. Inserting spaces where needed, trimming loose whitespace, etc...
Basically replicating ktlint formatter functionality
c
detekt
does not add additional support on top of
ktlint
, running detekt with
--auto-correct
option only performs the formatting that is already done by
ktlint
b
That's what I'm looking for! Thanks.
Would be good to have gradle tasks instead of flags for that, tho. Also I'm missing a task to setup git hooks that ktlint plugins provide
c
CLI option https://detekt.github.io/detekt/cli.html Gradle option for autoCorrect seems missing in the document, but there is an
autoCorrect
property inside the
detekt {}
👍 1