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

scalafix command to run library migration & hygiene rules #647

Closed
bjaglin opened this issue Feb 10, 2022 · 6 comments · Fixed by #2968
Closed

scalafix command to run library migration & hygiene rules #647

bjaglin opened this issue Feb 10, 2022 · 6 comments · Fixed by #2968
Assignees
Labels
enhancement New feature or request

Comments

@bjaglin
Copy link

bjaglin commented Feb 10, 2022

Is your feature request related to a problem? Please describe.

Scalafix provides a CLI which is rather easy to use to run syntactic rules (using on-demand scalameta parsers under the hood, like scalafmt) but is a hassle to setup to run semantic rules (requiring prior compilation output, namely class & semanticdb files). That's why we usually recommend using build tools plugins instead (either the official sbt plugin or the community-driven maven, gradle & mill plugins).

For projects managed by Scala CLI, using the Scalafix CLI is currently the only option. Providing a built-in integration with Scalafix inside Scala CLI would be useful to cover the typical Scalafix use cases on such projects:

  1. helping library clients to handle deprecation and breaking changes ("migration" use-case)
  2. enforcing conventions and preventing bad smells ("hygiene" use-case)

Describe the solution you'd like

A scalafix command could take care of

  • triggering semanticdb-enabled compilation (I assume this is already in place)
  • fetching Scalafix itself & community rules if provided (relying on scalafix-interfaces)
  • invoking Scalafix with the right arguments

Additional context

If Scala CLI adoption picks up, I assume https://github.com/scala-steward-org/scala-steward will eventually support projects managed by Scala CLI and be able to update directives. A support for running Scalafix migrations just like in the other build tools would then be welcome, and could rely on that built-in scalafix command.

Automating the bump of dependencies by updating directives might be implemented as part of Scala CLI itself in the future, but in any case integrating Scalafix (potentially without a user-facing command) will be useful to leverage existing migration rules.

@bjaglin
Copy link
Author

bjaglin commented Feb 10, 2022

cc @olafurpg @mlachkar

@romanowski
Copy link
Member

Thank you @bjaglin for opening the issue. We have got an issue open for adding support for scalafix for quite a while (see #15) but yours has much better motivation so I am going to close the old one as a duplicate.

@tgodzik tgodzik added the enhancement New feature or request label Aug 16, 2023
@Vigorge
Copy link
Contributor

Vigorge commented May 30, 2024

Hello, I'm interested in this question and have been working on an option for this improvement for some time. Now I can see some progress in my project and I plan to create a PR in the near future.

@tgodzik
Copy link
Member

tgodzik commented May 30, 2024

Sure! Do let us know if you need any help.

@arturopala
Copy link

Hello, any idea if this will ever come?

@bishabosha
Copy link
Contributor

Hello, any idea if this will ever come?

its in this PR #2968

@Gedochao Gedochao linked a pull request Jun 25, 2024 that will close this issue
@tgodzik tgodzik moved this to In progress in Issue Board Jun 27, 2024
@github-project-automation github-project-automation bot moved this from In progress to Done in Issue Board Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

6 participants