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

Fix false positive for UnnecessaryLet with disabled type resolution #2991

Merged

Conversation

cortinico
Copy link
Member

The fix is the same we applied for #2938 (restricting the rule to type resolution only).

Fixes #2987

Copy link
Member

@BraisGabin BraisGabin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add this example to the tests?

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

To ensure that in the future we just remove the if thinking "it's not necessary"

@codecov
Copy link

codecov bot commented Aug 20, 2020

Codecov Report

Merging #2991 into master will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #2991   +/-   ##
=========================================
  Coverage     80.29%   80.29%           
+ Complexity     2478     2477    -1     
=========================================
  Files           424      424           
  Lines          7479     7479           
  Branches       1370     1370           
=========================================
  Hits           6005     6005           
  Misses          760      760           
  Partials        714      714           
Impacted Files Coverage Δ Complexity Δ
...ab/arturbosch/detekt/rules/style/UnnecessaryLet.kt 80.43% <0.00%> (-1.79%) 13.00 <0.00> (ø)
...n/kotlin/io/gitlab/arturbosch/detekt/rules/Junk.kt 46.66% <0.00%> (-6.67%) 0.00% <0.00%> (ø%)
...lab/arturbosch/detekt/formatting/FormattingRule.kt 96.42% <0.00%> (+6.77%) 11.00% <0.00%> (-1.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8664cf6...4933635. Read the comment docs.

@arturbosch arturbosch added this to the 1.12.0 milestone Aug 20, 2020
@BraisGabin BraisGabin merged commit 102c28d into detekt:master Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False positive in UnnecessaryLet
4 participants