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

sanogueralorenzo

05/08/2020, 4:28 AM
Hello everyone, I switched to
buildUponDefaultConfig = true
recently and realised that overriden functions also show as
EmptyFunctionBlock
(I know there is a flag to ignoreOverriden) I'm more curious to know what was the reasoning behind leaving it to false and what is the best approach to solve situations where you are implementing an interface from the framework or third party provider that you have no control over.
b

Brais Gabin

05/08/2020, 7:27 AM
If you add a comment in the body of an overriden method the rule doesn’t flag it. I think that the reason for this is that if you didn’t implement a method you should say why. This way, if someone else read your code knows why that’s empty. If you work with Android this is a mess because there are far too much things that you don’t want to implement because anyone know that it’s pointless but 🤷 for that reason we have the switch.
s

sanogueralorenzo

05/08/2020, 3:51 PM
Makes sense, thank you!
4 Views