KT.REDUNDANT_EXPLICIT_TYPE

Local properties type is explicitly provided

Local properties do not need their type to be explicitly provided when the inferred type matches the explicit type.

Noncompliant Code

Copy
fun function() {
    val x: String = "string"
}

Compliant Code

Copy
fun function() {
   val x = "string"
}

The content on this page is adapted from the Detekt Docs. Copyright ©2022 The Detekt Team. All rights reserved. https://detekt.dev/comments.html