Skip to content
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

False positive in UnnecessaryLet #2987

Closed
BraisGabin opened this issue Aug 19, 2020 · 0 comments · Fixed by #2991
Closed

False positive in UnnecessaryLet #2987

BraisGabin opened this issue Aug 19, 2020 · 0 comments · Fixed by #2991

Comments

@BraisGabin
Copy link
Member

Expected Behavior

UnnecessaryLet takes in account if the we use the return value of let or not.

Observed Behavior

UnnecessaryLet flags some of those.

Steps to Reproduce

val a = listOf<List<String>?>(listOf(""))
    .map { list -> list?.let { it + it } }

Context

This is the same problem that #2938 but with UnnecessaryLet instead of UnnecessaryApply

Your Environment

  • Version of detekt used: 1.11.1
cortinico added a commit to cortinico/detekt that referenced this issue Aug 20, 2020
@arturbosch arturbosch added this to the 1.12.0 milestone Aug 20, 2020
BraisGabin pushed a commit that referenced this issue Aug 20, 2020
…2991)

* Fix false positive for UnnecessaryLet with disabled type resolution

* Add one more test to validate #2987
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants