Find class-declaration smells

Proprietary

Search-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$KtRecipe
mod 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.

  1. Find marker object declarations that could be data object
  2. Find sealed class declarations that could be sealed interface
  3. Find empty companion object declarations
  4. Find named companion object Constants patterns
  5. Find class Foo : Any() declarations
  6. Find class Foo {} declarations with an empty body
  7. Find empty init { } blocks
  8. Find classes with manual toString/equals/hashCode overrides
  9. Find classes with multiple overloaded secondary constructors
  10. Find classes that could be data class
  11. Find data class declarations with var properties
  12. Find object declarations with var properties
  13. Find abstract class declarations without abstract members
  14. Find open class declarations without overridable members