KT.FORBIDDEN_SUPPRESS

Usages of given rule are forbidden

This rule allows to set a list of rules whose suppression is forbidden. This can be used to discourage the abuse of the Suppress and SuppressWarnings annotations. Detekt will report suppression of all forbidden rules. This rule is not capable of reporting suppression of itself, as that's a language feature with precedence.

Noncompliant Code

Copy
package foo
// When the rule "MaximumLineLength" is forbidden
@Suppress("MaximumLineLength", "UNCHECKED_CAST")
class Bar

Compliant Code

Copy
package foo
// When the rule "MaximumLineLength" is forbidden
@Suppress("UNCHECKED_CAST")
class Bar

Options

  • rules (default: [])

    Rules whose suppression is forbidden.

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