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

IgnoredReturnValue: Fix false positive on chained statements #2895

Merged
merged 1 commit into from
Jul 25, 2020

Conversation

cortinico
Copy link
Member

Update the IgnoredReturnValue to use getTopmostParentOfType instead of getParentOfType. This allows use to capture the whole chain statement and not just the direct parent.

Moreover, I'm adding a check to make sure that chains that consumes a value (i.e. returns a Unit) are excluded from the inspection.

Fixes #2890

@codecov
Copy link

codecov bot commented Jul 25, 2020

Codecov Report

Merging #2895 into master will decrease coverage by 0.01%.
The diff coverage is 60.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2895      +/-   ##
============================================
- Coverage     80.18%   80.17%   -0.02%     
- Complexity     2425     2426       +1     
============================================
  Files           421      421              
  Lines          7369     7373       +4     
  Branches       1349     1351       +2     
============================================
+ Hits           5909     5911       +2     
  Misses          761      761              
- Partials        699      701       +2     
Impacted Files Coverage Δ Complexity Δ
...arturbosch/detekt/rules/bugs/IgnoredReturnValue.kt 79.16% <60.00%> (-2.66%) 12.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 2747fe9...bd0bd51. Read the comment docs.

@schalkms schalkms merged commit adaa717 into detekt:master Jul 25, 2020
@arturbosch arturbosch added this to the 1.10.1 milestone Jul 27, 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.

IgnoredReturnValue false positive
3 participants