-
Notifications
You must be signed in to change notification settings - Fork 502
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 a Scalafix migration for sbt-tpolecat v0.5.0 #3126
Add a Scalafix migration for sbt-tpolecat v0.5.0 #3126
Conversation
One thing to note - there is already an artifact migration in place for this project. Do I need to use the old or the new group ID in the Scalafix migration? |
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## main #3126 +/- ##
=======================================
Coverage 91.03% 91.04%
=======================================
Files 162 162
Lines 3404 3406 +2
Branches 311 315 +4
=======================================
+ Hits 3099 3101 +2
Misses 305 305 ☔ View full report in Codecov by Sentry. |
This artifact migration is going into effect for the first time with version 0.5.0, right? No prior version uses the new groupId?
If the answer to the above is yes, then you need to use the old groupId for the Scalafix migration. |
Ah perfect, thanks for the examples @fthomas! I've changed the migration to use the old group ID now as indeed this is the first release using the new group ID. |
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.
👍
The Scalafix migration is used for the update to 0.5.0, but I've seen it failing because the SemanticDB is missing for the files it tried to fix:
I don't know how the |
Hmm, I think that the meta-build will need to be compiled first as well with sbt-scalafix in Perhaps we need to change runBuildMigration so that it uses the same approach as runSourcesMigration, but in the meta-build? |
Perhaps something like this? private def runBuildMigration(buildRoot: BuildRoot, migration: ScalafixMigration): F[Unit] =
OptionT(latestSbtScalafixVersion).foreachF { pluginVersion =>
workspaceAlg.buildRootDir(buildRoot).flatMap { buildRootDir =>
val plugin = scalaStewardSbtScalafix(pluginVersion)
fileAlg.createTemporarily(buildRootDir / project / project, plugin).surround {
val withScalacOptions = migration.scalacOptions.fold(Resource.unit[F]) { opts =>
val options = scalaStewardScalafixOptions(opts.toList)
fileAlg.createTemporarily(buildRootDir / project, options)
}
withScalacOptions.surround {
val scalafixCmds = migration.rewriteRules.map(rule => s"$scalafixAll $rule").toList
val slurpOptions = SlurpOptions.ignoreBufferOverflow
sbt(Nel(reloadPlugins, scalafixEnable, scalafixCmds), buildRootDir, slurpOptions).void
}
}
}
} I'll try and test this out and send a PR |
That would be nice if it works. |
I opened #3133 with an attempt at fixing this! |
This PR adds a Scalafix migration for sbt-tpolecat v0.5.0, which will migrate many of the symbols in the project to a new package.