-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 Scalafix rewrites for 1.0.0 #1793
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1793 +/- ##
=======================================
Coverage 94.88% 94.88%
=======================================
Files 241 241
Lines 4147 4147
Branches 107 107
=======================================
Hits 3935 3935
Misses 212 212 Continue to review full report at Codecov.
|
This is awesome. I suggest that we make it available to more user sooner. |
I pushed another easy one ( @kailuowang I agree that merging soon would be a good idea. About the strategy to make this available to the users I would like @olafurpg's opinion, since I think this is the first real-world scenario of making a rewrite available with a library and things are still a bit sketchy. |
Great work @gabro! The simplest way to share a rewrite at the moment is to put it in a single source file under Alternatively, it's possible to publish the rewrites to Maven. As long as the artifacts are on the same classpath as scalafix then users can run the rewrites with The sbt plugin is a thin shim over the scalafix cli so it should be possible to integrate with other build tools than sbt. Pants has a scalafix integration, but I'm not aware of plugins for gradle or maven. I hope to release scalafix 0.5.0 later this week, I addressing a few issues in the sbt plugin first. |
thanks @gabro! I agree |
I just had a chat with @olafurpg about the best strategy for this, and we came up with the following solution (using scalafix 0.5):
This will allow users to run all the rewrites using the scalafix sbt plugin: We also drafted a solution for future versions of scalafix for making the process much simpler for both the rewrite authors and the users. @olafurpg will provide more details soon :) @kailuowang as soon as the "generated file" approach is in place, I think we can merge this PR and keep on iterating in different PRs :) |
My bad, I got some parts of that mixed up. There won't be any duplication, just a single |
This allows using `sbt scalafix github:typelevel/cats/v1_0_0` for invoking the rewrite.
Any recommendations for OSS repos where we can try out the migration? |
https://github.com/stew/dogs might be a good candidate. |
Now `a |@| b |@| c mapN f` correctly becomes `(a, b, c) mapN f`
@kailuowang I've covered a few corner case of the available rewrites and added some instructions on how to run the fixes. Take a look ;) |
Also, once this gets merged I would suggest to use the original issue as an aggregation point for bug reports and general feedback. I expect a lot of corner cases will be found. |
Looking great to me, thanks so much! 👍 |
Would love to get this merge and start to benefit users and iterate. |
LGTM. I'd like to see this merged ASAP :-) |
scalafix/project/plugins.sbt
Outdated
@@ -0,0 +1,5 @@ | |||
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.5.0-M1") |
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 line is repeated :)
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.
good catch, thank you!
scalafix/project/plugins.sbt
Outdated
@@ -0,0 +1,5 @@ | |||
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.5.0-M1") | |||
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.5.0-M1") |
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.
Once is good enough, right?
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.
most definitely! Good catch, thanks :)
Updated, I've removed the duplicated line in plugins and bumped scalafix to the latest 0.5.0-M2 version. |
This is a WIP for #1791.
It's very preliminary, but feel free to share your thoughts, try this out and add more edge cases to the tests!