Hey everyone :wave:, Does anyone know of a complex...
# detekt
s
Hey everyone 👋, Does anyone know of a complex example configuring KtLint/formatting for Detekt? I’m currently using KtLint only, and am interested on migrating (back) to Detekt and leveraging the KtLint support underneath.
đź‘€ 1
g
It depends on what “complex example” means for you.
Imho this is a good starting point: https://github.com/cortinico/kotlin-android-template/
b
But this is applying ktlint separatelly, so not really helpful for using embedded ktlint in detekt
g
The template has bot enabled, so you can simply remove the one you’re not interested (in your case
ktlint
).
s
I’m looking mostly to always enforce return types, not allow any star-imports. And auto-formatting the codebase. I’m not particularly attached to KtLint, but those are my most important rules. Besides that I just follow the Official Kotlin Style Guide.
g
I’m looking mostly to always enforce return types, not allow any star-imports.
Those are supported by Detekt first party rules IIRC (no need to use the ktlint wrapper).
And auto-formatting the codebase.
That’s not supported by detekt out of the box. You have to use
detekt-formatting
(the ktlint wrapper).
s
Thanks @gammax! 👍
🙏 1