Hi. What is the motivation to copy over ktlint rules? We always assumed detekt to be semantics check...
j
Hi. What is the motivation to copy over ktlint rules? We always assumed detekt to be semantics checker and ktlint to be formatting checker. Does detekt want to replace ktlint?
b
Detekt doesn't replace ktlint. It just integrates with it. Under the hood same ktlint binary is downloaded and executed.
Or did you mean some overlapping "style" rules that at the moment needs to be configured twice in detekt.yml?
j
So my question was based on the changelog here:
Now I've opened those PRs and it seems to "reregister those rules from Ktlint", so I'm now puzzled even more 😄
b
Hmm, maybe they're trying to merge duplicated rules? I personally would love to have ktlint integrated into base detekt binary rather than being a plugin.
g
We wrap every new KtLint rule so that you can use it if you use
detekt-formatting
(the Ktlint wrapper).
If we would not do that, you won’t be able to execute those KtLint rules from Detekt.
j
So detekt is kind of another ktlint-gradle plugin? I didn't know that at all! 🙂
g
kind of another ktlint-gradle plugin?
Essentially with Detekt you can create custom rules. We create a set of rules that internally are running KtLint and called this
detekt-formattign
as those are also the only rules that are effectively ‘formatting’ your code. So yeah it’s a bit like a ktlint-gradle plugin
j
Thank you for clearing this up for me :)