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

test/document usage of local 2.13 rules #128

Merged
merged 1 commit into from
Jun 16, 2020

Conversation

bjaglin
Copy link
Collaborator

@bjaglin bjaglin commented Jun 16, 2020

Somehow, this got lost when I addressed @olafurpg's comments. It demonstrates the second goal of #121

  1. Advanced users with local rules targeting 2.11 or 2.13 code will be able to simplify their build

libraryDependencies += "ch.epfl.scala" %% "scalafix-core" % Versions.scalafixVersion,
libraryDependencies += "joda-time" % "joda-time" % "2.10.6"
)

val service = project
.dependsOn(rules % ScalafixConfig)
.settings(
scalaVersion := Versions.scala213,
libraryDependencies += "com.nequissimus" % "sort-imports_2.12" % "0.5.0" % ScalafixConfig
libraryDependencies += "com.nequissimus" %% "sort-imports" % "0.5.2" % ScalafixConfig
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, I am using an external rule here as I need multiple rules, so I can't stick to example-scalafix-rule.

@bjaglin bjaglin marked this pull request as ready for review June 16, 2020 14:20
@bjaglin bjaglin requested a review from mlachkar June 16, 2020 14:45
@bjaglin bjaglin merged commit de8145f into scalacenter:master Jun 16, 2020
@jrudolph
Copy link

I ran into this as well following the instructions from https://scalacenter.github.io/scalafix/docs/developers/local-rules.html. Might make sense to update the instructions there as well.

@bjaglin
Copy link
Collaborator Author

bjaglin commented Jul 30, 2020

@jrudolph do you mean that https://scalacenter.github.io/scalafix/docs/developers/local-rules.html#prerequisite should also suggest setting the Scala version at the build level?

@jrudolph
Copy link

@jrudolph do you mean that scalacenter.github.io/scalafix/docs/developers/local-rules.html#prerequisite should also suggest setting the Scala version at the build level?

Doh, I missed that part at the top :) Maybe it's enough to include the error message that you will get if you don't do it there which was a generic "Provider ... could not be instantiated". Maybe a safeguard could be built into the scalafix invocation to avoid that the classpath contains incompatible classes/jars (e.g. just look for wrong "scala_2.13" in classpath or jar file names)? Maybe that would probably not only be useful for the local rules scenario as soon as cross publishing will be more common.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants