Is it possible to import a detekt-config.yml into ...
# detekt
g
Is it possible to import a detekt-config.yml into IntelliJ/Android Studio code style settings in some way?
j
Detekt has IDEA plugin where you can choose config, then if you set it to show findings as errors you see them in live in code editor
m
It will show them as warnings by default too, so 2 ways to see them.
g
The reason why I'm asking is that I'd like to be able to have my IDE-built-in formatter use the rules given by detekt and not having to run the format task each time. It would be sufficient for me to just have a script that converts the detekt-config.yml (at least the relevant parts) to a IDEA-compatible codestyle.xml.
m
I don’t think Detekt recommends using their formatting rules, and especially since there are official Kotlin coding conventions and built-in formatting in IntelliJ.
j
Detekt uses ktlint formatter rules. So we have IDEA set up for ktlint https://github.com/pinterest/ktlint/blob/master/README.md
g
Ah, I see, just imported the ktlint ruleset into idea. This is exactly what I wanted, thanks for the tip 🙂
117 Views