-
-
Notifications
You must be signed in to change notification settings - Fork 767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix UnnecessaryLet false positive in inner lambdas #3841
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3841 +/- ##
============================================
- Coverage 83.58% 83.57% -0.01%
Complexity 3110 3110
============================================
Files 456 456
Lines 8931 8932 +1
Branches 1748 1747 -1
============================================
Hits 7465 7465
Misses 551 551
- Partials 915 916 +1
Continue to review full report at Codecov.
|
That doesn't seem as a false positive. It could be replaced with an if. |
@BraisGabin from the docs a?.let { print(it) } is compliant |
also, fun callMe(callback: () -> Unit) {
callback()
}
fun test(value: Int?) {
value?.let {
callMe {
it.plus(it)
}
}
} would also be reported, which is a false positive |
You are right. For me that's an unnecessary usage but this rule, right now, should not flag it. |
Hi, thank you very much for reviewing this PR. Is there anything else I need to do before this PR can be merged ? |
I don't think so. Sorry for the late merge and thanks for the fix :) |
When upgrading detekt to 1.7.1, I noticed some false positives for
UnnecessaryLet
.For example:
would be reported.
This PR should fix the issue