KT.USE_CHECK_NOT_NULL

Call for not-null check can be replaced with a 'checkNotNull()' call

Turn on this rule to flag check calls for not-null check that can be replaced with a checkNotNull call.

Noncompliant Code

Copy
check(x != null)

Compliant Code

Copy
checkNotNull(x)

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