-
Notifications
You must be signed in to change notification settings - Fork 185
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 noUniversalEquality option to DisableSyntax #877
Conversation
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.
This looks great! Thanks @gabro Left one question
scalafix-rules/src/main/scala/scalafix/internal/rule/DisableSyntax.scala
Outdated
Show resolved
Hide resolved
scalafix-rules/src/main/scala/scalafix/internal/rule/DisableSyntax.scala
Outdated
Show resolved
Hide resolved
scalafix-rules/src/main/scala/scalafix/internal/rule/DisableSyntax.scala
Outdated
Show resolved
Hide resolved
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.
LGTM 👍 Thank you @gabro ! I will follow up with a PR to make sure the new setting doesn't appear on the website until the next release, not sure yet how to implement that.
"Reporter message for noUniversalEquality" | ||
) | ||
noUniversalEqualityMessage: String = | ||
"Universal equality should be avoided since it's not typesafe", |
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.
We may want to refine this message down the road, but it's not blocking
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'm open to suggestions :)
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.
== is unsafe since it allows comparing two unrelated types
Closes #874
I hacked this together in 10 minutes, so I may be missing some edge cases.
I've explicitly restricted the rule to infix applications of==
as I don't think handling non-infix applications (e.g.,1.==(2)
) is worth the (albeit low) effort.