You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val a: Any?
val key: String = a.toString() // this line should be flagged
val key2: String = "$a" // same here
This code compiles, and have a defined behaviour. But, usually, it is a potential bug. The idea is to have a rule that detects the use of toString() (explicit or implicit) and flag it.
Expected Behavior of the rule
This code compiles, and have a defined behaviour. But, usually, it is a potential bug. The idea is to have a rule that detects the use of
toString()
(explicit or implicit) and flag it.Context
It's really strange that you really want to print
"null"
when you have anull
value. If you are working with UI you probably want""
,"-"
or something else. And the same works for any other piece of code for example this one: https://github.com/detekt/detekt/pull/2898/files#diff-6576486bfd0ee34b1da2a5967fba6cf4R27The text was updated successfully, but these errors were encountered: