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 false positives #3043

Closed
yogurtearl opened this issue Aug 31, 2020 · 1 comment · Fixed by #3169
Closed

IgnoredReturnValue false positives #3043

yogurtearl opened this issue Aug 31, 2020 · 1 comment · Fixed by #3169

Comments

@yogurtearl
Copy link
Contributor

Expected Behavior

Using RxJava 2.2.19

Observable.just(...)
            .take(1)
            .map {...
            }
           .kotlinExtensionMethod()
          .subscribe({... }, {...})

Should be no IgnoredReturnValue detekted becase we use the results of take and map

Observed Behavior

This triggered IgnoredReturnValue on take and map

Context

We have to disable this rule as a workaround.

Your Environment

  • Version of detekt used: 1.12.0
  • Version of Gradle used (if applicable): 6.6.1 (with Android)
  • Operating System and version: macOS 10.15
@vladimirfx
Copy link

Same issue with chained method call:

    assertThat(debt.devicesDebts)
        .extracting(Function<DevicesDebts, Instant?> { it.sentDate })
        .containsOnlyNulls()

Here extracting(..) is marked with @CheckReturnValue but containsOnlyNulls() is not. So value returned by extracting(..) is consumed.

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.

4 participants