in src/main/kotlin/com/dd/detektcustomrules/rules/ExpressionFunctions.kt [15:30]
override fun visitNamedFunction(function: KtNamedFunction) {
super.visitNamedFunction(function)
function.bodyBlockExpression?.statements?.let { expressions ->
if (expressions.size == 1 && expressions.first() is KtReturnExpression) {
report(
CodeSmell(
issue = issue,
entity = Entity.from(function),
message = "${function.name} only contains a single expression and can be represented as an expression function"
)
)
}
}
}