Add linter for any discarded value
I suggest adding a linter that will warn for any discarded value, regardless of its type. This would both catch unused effectful code that's not concrete IO - it would need to be disabled for blocks of side-effecting code, but I see this as an extra advantage since side-effecting code would have to be explicitly marked as such.
Do you think this is something we could upstream to scalafix itself?
I've been staring at your general linters in http4s wondering if they might take them too.
Good point! The "redundant final object" rule has already been upstreamed and scalafix itself seems to be more actively maintained than it was a while back.
I saw that! Nice work on it :) yes, they've been responsive to my ideas to upstream some stuff from our build here too.
Linking to:
- https://github.com/scalacenter/scalafix/issues/1620
If someone points me to a repo that demonstrates a gotcha, I will test -Wnonunit-statement against it. Currently, I'm just running it over the compiler project to avoid noise, as opposed to demonstrating utility. I think it noticed one or two possible bugs, but the imperative compiler and library are freely side-effecting.
I think this is obsolete now that -Wnonunit-statement exists