Find class-declaration smells
ProprietarySearch-only bundle: flags class-level structural smells (empty companion, empty class body, redundant : Any(), manual toString/equals/hashCode trio, named companion of constants, multiple secondary constructors, sealed-class-without-state, marker-object-without-data, empty init, all-val classes that could be data class, mutable data class/object state, abstract classes without abstract members, and open classes with no overridable members).
org. openrewrite. kotlin. bestpractices. FindClassStructureSmells$KtRecipemod run . --recipe= 'org. openrewrite. kotlin. bestpractices. FindClassStructureSmells$KtRecipe'Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.
Recipe list
It runs these recipes, in this order.
- Find marker
objectdeclarations that could bedata object - Find
sealed classdeclarations that could besealed interface - Find empty
companion objectdeclarations - Find named
companion object Constantspatterns - Find
class Foo : Any()declarations - Find
class Foo {}declarations with an empty body - Find empty
init { }blocks - Find classes with manual
toString/equals/hashCodeoverrides - Find classes with multiple overloaded secondary constructors
- Find classes that could be
data class - Find
data classdeclarations withvarproperties - Find
objectdeclarations withvarproperties - Find
abstract classdeclarations without abstract members - Find
open classdeclarations without overridable members