-
-
Notifications
You must be signed in to change notification settings - Fork 777
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] Add returnType?.isNothing()
check
#7772
base: main
Are you sure you want to change the base?
[IgnoredReturnValue] Add returnType?.isNothing()
check
#7772
Conversation
returnType?.isNothing()
checkreturnType?.isNothing()
check
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7772 +/- ##
============================================
- Coverage 85.44% 85.43% -0.01%
- Complexity 4175 4177 +2
============================================
Files 571 571
Lines 13136 13137 +1
Branches 2489 2490 +1
============================================
Hits 11224 11224
Misses 664 664
- Partials 1248 1249 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x"D I was just reviewing the issue and saw "oh there is a PR already". I enter and it was just 1 minute old :P
Thanks for all the contributions (I know that you have more things that need my review but I have not the time :'( )
fun `does not report when a function returns Unit`() { | ||
val code = """ | ||
fun foo() { | ||
println(42) | ||
} | ||
""".trimIndent() | ||
val findings = subject.compileAndLintWithContext(env, code) | ||
assertThat(findings).isEmpty() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't we have a test for this case? Good catch then!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could only find Unit involving with chain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this issue!
I’d also like to have an explicit test case for Nothing
, e.g.
fun fail(message: String): Nothing {
//…
}
Fixes #7765