Prefer pattern matching over isInstanceOf/asInstanceOf chains

Proprietary

Finds if statements that check isInstanceOf in the condition and use asInstanceOf in the then-part. Replace with pattern matching for idiomatic Scala.

org.openrewrite.scala.cleanup.PreferPatternMatchOverInstanceOf
mod run . --recipe=org.openrewrite.scala.cleanup.PreferPatternMatchOverInstanceOf

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.