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

Peter Mandeljc

05/31/2022, 9:00 AM
hm, would it make sense to have a rule for defining exception as object? I think stacktrace would not be correct, if I do following:
Copy code
object TitanicSinking : RuntimeException()

// somewhere else
throw TitanicSinking
I think that's what you are looking for, right?
p

Peter Mandeljc

05/31/2022, 12:06 PM
yep, didn't notice that, cool
👍 1
hm, I actually have it enabled, but it didn't detect it. Will double check and submit bug report if needed
b

Brais Gabin

05/31/2022, 12:30 PM
Do you use Type Solving?
p

Peter Mandeljc

05/31/2022, 12:31 PM
not sure, where can I see that?
b

Brais Gabin

05/31/2022, 12:31 PM
Do you run
detekt
or `detektMain`/`detektTest`?
p

Peter Mandeljc

05/31/2022, 12:32 PM
just
detekt
b

Brais Gabin

05/31/2022, 12:34 PM
That's the reason. That rule only works with type solving enabled: https://detekt.dev/docs/gettingstarted/type-resolution/
You will get a lot more findings enabling it but it is slower.
We should remove the "experimental tag" on it. We aren't going to break it. And if we do that we will do that on 2.0
p

Peter Mandeljc

05/31/2022, 12:40 PM
I see, thanks!
6 Views