hi, I want to integrate detekt formatting into my ...
# detekt
a
hi, I want to integrate detekt formatting into my Android app but it’s not very clear for me what steps to follow from the documentation… the docs in GitHub just mention a dependency block in gradle and that’s it. Is there any gradle task like “ktLintFormat” that is added that I can use to automatically format my code for example? or how does it works? thank you in advance and sorry for the complete ignorance on this matters, I’m kind of new to all this tools
g
It’s documented here: https://detekt.dev/docs/rules/formatting/ You won’t have an extra task, it will be executed as part of your
detekt
/
detektMain
task.
If you want to reformat the code, you can invoke it with ``--auto-correct`
And yeah 😞 The docs on this are really limited, we should definitely improve them
s
Is there way to run detekt formatting specific items set to true and all other false, from command line? Mainly to keep scope of formatting changes smaller.
g
Not sure I follow you. Like do you want to run only one rule?
a
That’s what I was looking for @gammax , Thank you
s
@Subodh Nijsure sure, you can do that. Just set the
formatting
ruleset to
true
and the other ruleset to
false
. Then only rules from the
formatting
ruleset are executed. More information is available here: https://detekt.dev/docs/introduction/configurations
101 Views