-
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 scalafixProject
helper to sbt-scalafix?
#1619
Comments
I am really happy to get some feedback about sbt-scalafix which could get some UX love. Thanks for the initiative and for opening up a discussion about upstream it! I agree that there is currently a lot of boilerplate to set up a sbt project defining scalafix rules - https://github.com/scalacenter/scalafix.g8 was built to try to mitigate that. At this point, scalafix is not published for Scala 3 (main blocker being that scalameta isn't either), but does support Scala 3 sources through On the proposal overall, I have mixed feelings about abstracting the testkit infrastructure behind that DSL, as it adds more magic on top of vanilla sbt. I have the feeling that verbose/explicit syntax might be more accessible for newcomers. We'd have to ask the community if "less is more" applies in that context I guess. About the naming, I feel like |
Thanks for the response, and your interest! :)
Ah yes, good point about Scala 3, completely agree about that. If/when that comes through I agree this will work out much nicer, fingers crossed for GSoC 🤞
Absolutely, it's a trade-off. From my work on sbt-typelevel, my default stance is any boilerplate configuration that is repeated in 90-something % of builds should be upstreamed and baked into some "magic" command. Another advantage of this is it's easier to roll out improvements. When you update a template, it doesn't help the all the projects that used an old version of the template. I do think there's an interesting comparison here with So my argument for it would be the same here: if setting up a publishable scalafix project becomes one line of "magic" sbt, then hopefully more people will do it, and that's the most important thing of all :) IMHO. Also note that having this helper method doesn't preclude users from doing it the manual way, and for the docs/templates to demonstrate that as well.
For sure, I didn't think too hard about the name at this stage :) |
In typelevel/typelevel-scalafix#21 we added a helper method to setup scalafix projects. The actual plugin source can be found in:
https://github.com/typelevel/typelevel-scalafix/blob/676237e55e3cf5f8c52743929137dd119685a08b/project/ScalafixProjectPlugin.scala
The idea is conceptually similar to the
crossProject
helper from sbt-crossproject: essentially, to setup a composite project that helps configure the related sub-projects (i.e.,rules
,input
,output
, andtest
).Here's an example of how it can be used:
This sets up:
cats-rules
project, with a dependency toscalafix-core
.cats-input
project, set to no-publish, and with a dependency tocats-core
.cats-output
project, set to no-publish.cats-tests
project:cats-rules
sub-projectScalafixTestkitPlugin
scalafixTestkitOutputSourceDirectories
,scalafixTestkitInputSourceDirectories
,scalafixTestkitInputClasspath
,scalafixTestkitInputScalacOptions
,scalafixTestkitInputScalaVersion
Is this something sbt-scalafix would be interested in? I'm happy to make a PR. Thanks!
The text was updated successfully, but these errors were encountered: