KT.FORBIDDEN_IMPORT

Forbidden import

This rule allows to set a list of forbidden imports. This can be used to discourage the use of unstable, experimental or deprecated APIs. Detekt will then report all imports that are forbidden.

Noncompliant Code

Copy
package foo

import kotlin.jvm.JvmField
import kotlin.SinceKotlin

Options

  • imports (default: [])

    imports which should not be used

  • forbiddenPatterns (default: ``)

    reports imports which match the specified regular expression. For example net.*R.

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