KT.UNNECESSARY_NOT_NULL_OPERATOR

Unnecessary not-null operator (!!)

Reports unnecessary not-null operator usage (!!) that can be removed by the user.

Noncompliant Code

Copy
val a = 1
val b = a!!

Compliant Code

Copy
val a = 1
val b = a

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