https://kotlinlang.org logo
#detekt
Title
# detekt
b

Big Chungus

02/07/2021, 6:44 PM
Is it possible tu use detekt as formatter instead of ktlint?
c

chao

02/07/2021, 6:45 PM
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

Big Chungus

02/07/2021, 6:46 PM
Well general formatting. Inserting spaces where needed, trimming loose whitespace, etc...
Basically replicating ktlint formatter functionality
c

chao

02/07/2021, 6:47 PM
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

Big Chungus

02/07/2021, 6:48 PM
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

chao

02/07/2021, 6:50 PM
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
15 Views