assertk
assertk copied to clipboard
Add `@CheckResult`/`@CheckReturnValue` to `assertThat`
Add @CheckResult/@CheckReturnValue to assertThat so that Detekt can makes sure that you do something with the result of the assertThat methods.
See https://detekt.github.io/detekt/potential-bugs.html#ignoredreturnvalue
You could use an existing annotation from another dependency, or even just assertk.annotation.CheckReturnValue would be good enough to use with the detekt rule.
Related:
- Errorprone check: https://errorprone.info/bugpattern/CheckReturnValue
- Jspecify might add an annotation: https://github.com/jspecify/jspecify/issues/200
- Kotlin might add something related: https://youtrack.jetbrains.com/issue/KT-12719
Looks like there's traction for something official in kotlin for this https://youtrack.jetbrains.com/issue/KT-12719/Add-CheckResultMustUseReturnValueDiscardableResult-to-warn-about-unused-return-value#focus=Comments-27-6530269.0-0, will probably use that when it's available.