KT.REDUNDANT_VISIBILITY_MODIFIER_RULE

Redundant visibility modifier

This rule checks for redundant visibility modifiers. One exemption is the explicit API mode In this mode, the visibility modifier should be defined explicitly even if it is public. Hence, the rule ignores the visibility modifiers in explicit API mode.

Noncompliant Code

Copy
public interface Foo { // public per default

    public fun bar() // public per default
}

Compliant Code

Copy
interface Foo {

    fun bar()
}

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