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

cmgurba

10/04/2019, 3:11 PM
apologies if this has been asked before: couldn't find in search. Is there a setting for enforcing explicit return type declaration on all functions? I think this would help my team's readability. Specifically this often gets omitted in Single Expression Functions
fun myFun(a,b) = logic()
. Rather than police improper usage of single expression i thought it'd just be easier to enforce return types across the board.
👍 2
m

Mike

10/04/2019, 3:19 PM
I don't see one either. One issue is it would require functions that don't really return anything, to return a Unit. Unless the processor really digs in and determines the function doesn't return. Perhaps it does. At this point, it's a feature request, or you create a custom rule and ideally contribute it. I'm sure thee are others that would turn this on for public functions definitely.
s

schalkms

10/04/2019, 7:55 PM
There's none at the moment. This might be a good idea for a custom rule. https://arturbosch.github.io/detekt/extensions.html#custom-rulesets