You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A lambda that uses the implicit it parameter with a single statement spread over multiple lines should be reported by the MultilineLambdaItParameter rule
Observed Behavior
Nothing is reported
Steps to Reproduce
fun detektTest(strings: List<String>): List<String> {
return strings
.flatMap {
it
.reader()
.readLines()
}
}
As mentioned there, this caused confusion in one of our PRs where code that we expected to fail the rule was passed and then had to be caught by a code reviewer. This behaviour was introduced in this PR and there was a comment thread in that PR asking similar questions about the behaviour not matching the rule name that doesn't have a conclusion.
Would appreciate some clarity around whether this rule intends to ban any multi-line lambda using an it parameter, or only multi statement lambdas
Your Environment
Version of detekt used: 1.23.4
Version of Gradle used (if applicable): 8.7
Gradle scan link (add --scan option when running the gradle task):
Operating System and version: MacOS 14.4.1
Link to your project (if it's a public repository):
The text was updated successfully, but these errors were encountered:
Expected Behavior
A lambda that uses the implicit it parameter with a single statement spread over multiple lines should be reported by the
MultilineLambdaItParameter
ruleObserved Behavior
Nothing is reported
Steps to Reproduce
Context
Based on the name of the rule, its reasonable to expect that any lambda with code spanning multiple lines should be flagged. I raised this in the kotlinlang discord here: https://kotlinlang.slack.com/archives/C88E12QH4/p1712167796864189
As mentioned there, this caused confusion in one of our PRs where code that we expected to fail the rule was passed and then had to be caught by a code reviewer. This behaviour was introduced in this PR and there was a comment thread in that PR asking similar questions about the behaviour not matching the rule name that doesn't have a conclusion.
Would appreciate some clarity around whether this rule intends to ban any multi-line lambda using an it parameter, or only multi statement lambdas
Your Environment
--scan
option when running the gradle task):The text was updated successfully, but these errors were encountered: