KT.UNNECESSARY_INNER_CLASS

Unnecessary inner class

This rule reports unnecessary inner classes. Nested classes that do not access members from the outer class do not require the inner qualifier.

Noncompliant Code

Copy
class A {
    val foo = "BAR"
    inner class B {
        val fizz = "BUZZ"
        fun printFizz() {
            println(fizz)
        }
    }
}

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