-
Notifications
You must be signed in to change notification settings - Fork 137
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
Merge scalafix
into fix
#3400
Merge scalafix
into fix
#3400
Conversation
e37dd0f
to
613b811
Compare
d7ea710
to
9a45a8b
Compare
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, just one minor comment
Not sure if this PR is the right forum to open a discussion (happy to continue wherever is more suited, just let me know!), but I was surprised by this UX change that I found out while reading the release notes, particularly because scalafix already has a concept built-rules. While I share the concern about having several fix commands, I am not sure that users will understand what "built-in rules" refer to and how they can be opted-in/out. As far as I can tell, at the moment, there is no way to opt-out from the scala-cli built-in rule, while all scalafix built-in rules are opt-in (until #3330 at least). Maybe a way to bring some clarity for users would be to rewrite the scala-cli built-in rule as a scalafix rule (potentially maintained in this repo together with the build), publish it as a regular scalafix external rule but load by default when scalafix is run through scala-cli, allowing users to opt-in/out via (1) from #2309 looks non-trivial to implement as a Scalafix rule as the Scalafix API is very file-centric, but it should be doable by
I am obviously biased as the Scalafix core maintainer, but if this turns out to work without any change in Scalafix (as I hope), we would have another impactful community rule that rule authors can get inspiration from for their own use-case, and if we hit some limitations, we could extend the Scalafix API, which would also benefit rule authors. Maybe that would also be an opportunity to parse/prettyprint scala-cli directives in Scalameta, to reduce the string parsing/building logic here? |
You should be able to do Having a scalafix rules that would do the same would also be quite useful, since it is much more complex I am not sure when we would be able to write it. |
Indeed, since there is only one scala-cli built-in rule at the moment, this flag does the job, but as soon as we have more than one built-in rule, we would likely need a toggle per rule.
To start with, we could have a no-op Scalafix rule just for the sake of enabling |
I don't think we plan on having more and I would prefer to try to use scalafix API next time. If we had more than one rule, then maybe we could migrate to
I think I am a bit lost here. Why would we need it? |
|
That would definitely reduce the ambiguity. I guess this is a decision that needs to be taken if/when
I think this is where my concern is back: will users understand that the same command can control rules of different type/distribution channels via different CLI options? |
Yeah, I guess it's a tough one. Though I wonder if from user perspective it makes any difference and should we make that difference visible or go the other way? |
Closes #3327
This merges the
scalafix
sub-command intofix
.Former
fix
functionalities are now referred to in the code as thebuilt-in
rules.Effectively,
fix
now runes 2 separate sets of rules (both enabled by default):built-in
andscalafix
.They can be controlled via the
--enable-scalafix
and--enable-built-in
command line options.