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 negative in IgnoredReturnValue #3170

Closed
BraisGabin opened this issue Oct 25, 2020 · 0 comments · Fixed by #3179
Closed

False negative in IgnoredReturnValue #3170

BraisGabin opened this issue Oct 25, 2020 · 0 comments · Fixed by #3179

Comments

@BraisGabin
Copy link
Member

Expected Behavior

A use of an annotated method with @CheckReturnValue at the end of an if expression should be flagged by IgnoredReturnValue if the output of the if is not used.

Same for the when.

Steps to Reproduce

package test

import kotlin.random.Random

@CheckReturnValue
fun returnsInt() = 42

if (Random.nextBoolean()) {
    println("hello")
} else {
    returnsInt()
}

Your Environment

  • Version of detekt used: master (1.14.2)
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.

3 participants