Find lambda / functional smells
ProprietaryRedundant map { it.toString() } / forEach { it.toString() }, debug-leftover .also { println(it) } / forEach { println(it) }, xs.toList().forEach { } over already-iterable receivers, .also { it.add(...) }-built mutable collections, and forEach { ys.add(it) } (use addAll).
org. openrewrite. kotlin. bestpractices. FindLambdaSmells$KtRecipemod run . --recipe= 'org. openrewrite. kotlin. bestpractices. FindLambdaSmells$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
map { it.toString() }/map { x -> x.toString() }patterns - Find
forEach { it.toString() }patterns - Find
.also { println(it) }debug patterns - Find
forEach { println(it) }patterns - Find
xs.toList().forEach { … }patterns - Find
mutableListOf<T>().also { it.add(x) }patterns - Find
mutableMapOf<K,V>().also { it.put(...) }patterns - Find
mutableSetOf<T>().also { it.add(x) }patterns - Find
xs.forEach { ys.add(it) }patterns