Is there any way to configure `detekt` to mark the...
# detekt
t
Is there any way to configure
detekt
to mark the unused methods as a code smell?
m
That’s way beyond the capabilities of a static code analyzer, unless you want it to be really slow. If I’m not mistaken, Detekt is analyzing each file in isolation. Also unused method detection is very hard. Just ask Jetbrains how hard it is for IntelliJ to do it. IntelliJ analysis will tell you about unused methods, and even it isn’t 100% accurate.
s
I don’t think Detekt has the capability to detect unused code, that’d require multiple scan passes. Right now Detekt scans files one-by-one and the scan of each file is completely separate from the scan of another file. Would require a massive rework… Android Lint does that (an many other things), you may wanna write a rule for that — despite the name, it works just fine on JVM-only projects as well
But yeah as @Mike points out — performance will greatly suffer from something like that, it’s not a trivial matter (see reflection, for one)