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

Add linter for any discarded value #32

Open
bplommer opened this issue Jun 20, 2022 · 6 comments
Open

Add linter for any discarded value #32

bplommer opened this issue Jun 20, 2022 · 6 comments

Comments

@bplommer
Copy link
Contributor

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.

@bplommer bplommer changed the title Linter for any discarded value Add linter for any discarded value Jun 20, 2022
@armanbilge
Copy link
Member

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.

@bplommer
Copy link
Contributor Author

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.

@armanbilge
Copy link
Member

I saw that! Nice work on it :) yes, they've been responsive to my ideas to upstream some stuff from our build here too.

@armanbilge
Copy link
Member

@som-snytt
Copy link

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.

@Daenyth
Copy link

Daenyth commented Jul 24, 2023

I think this is obsolete now that -Wnonunit-statement exists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants