Find Charset.forName(...) calls inside loops

Proprietary

Charset.forName("UTF-8") walks the charset alias map on every call. Prefer the cached constants on kotlin.text.Charsets (Charsets.UTF_8, Charsets.ISO_8859_1, etc.) — or hoist a single Charset out of the loop.

org.openrewrite.kotlin.performance.FindCharsetForNameInLoops$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.performance.FindCharsetForNameInLoops$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.