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

Rules for ADTs and case classes #1621

Open
1 of 4 tasks
armanbilge opened this issue Jun 23, 2022 · 2 comments
Open
1 of 4 tasks

Rules for ADTs and case classes #1621

armanbilge opened this issue Jun 23, 2022 · 2 comments

Comments

@armanbilge
Copy link

Back again, with more potential upstream candidates :)

@bplommer wrote us some very nice internal scalafix rules for http4s. They are generally applicable, particularly for OSS libraries that must be mindful about binary compatibility. So we would like to give you the right of first refusal before we upstream it to typelevel-scalafix 😉

Thanks, appreciate your time to look into these!

@bjaglin
Copy link
Collaborator

bjaglin commented Jun 27, 2022

Welcome back ;)

A lot of interesting linter rules! I am all in for accepting them upstream (same pros and cons as described in #1620 (comment)). Actually, I had started implementing https://nrinaudo.github.io/scala-best-practices/adts/ as rules but never published my WIP.

Maybe we could group them under some kind of SafeADT rule, with some configuration allowing opt-out?

@armanbilge
Copy link
Author

armanbilge commented Jun 27, 2022

Fantastic! Glad to hear that :) thank you so much.

Maybe we could group them under some kind of SafeADT rule, with some configuration allowing opt-out?

Yes, that makes sense to me. Those ADT best practices look good too, although I'm curious about whether the advice to mark case objects as final is still relevant in modern Scala, and if so how it relates to the RedundantSyntax.finalObject rule.

Edit: ah, I think that's covered in the docs :)

Note: in Scala 2.12 and earlier removing the `final` modifier will slightly change the resulting bytecode - see [this bug ticket](https://github.com/scala/bug/issues/11094) for further information.

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

No branches or pull requests

2 participants