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

adam-mcneilly

11/21/2019, 4:01 PM
High level question: is there any way to have detekt enforce that you use named arguments? Specifically, I was thinking this would be helpful for methods or constructors that have say at least 3 arguments. I haven't found anything in the detekt config that relates to this, but I'm also not sure if it's possible - how would static analysis know if the method I'm calling supports named arguments - it might not if it's a java interrop, right?
If there's more to discuss here I'm happy to open an issue.
s

schalkms

11/21/2019, 6:40 PM
This is a good example for a custom domain-specific rule that you could implement for you and your team. Detekt allows custom rules by using the
ServiceLoader
pattern to collect all custom rules. Reference: https://arturbosch.github.io/detekt/extensions.html#custom-rulesets
a

adam-mcneilly

11/21/2019, 10:31 PM
Cool, thanks! I will try it out sometime & if I make it work I'll make sure to come back here and share. 🙂
👍 3
s

schalkms

11/24/2019, 6:54 PM
Thanks! We highly appreciate users contributing back to the project and giving helpful feedback.
2 Views