Skip to content

Commit

Permalink
Add post-update hook for sbt-java-formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
fthomas committed Nov 8, 2021
1 parent d1f07c4 commit c2b9977
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ object HookExecutor {
enabledByConfig = _ => true
)

val postUpdateHooks: List[PostUpdateHook] =
private val scalafmtHook =
PostUpdateHook(
groupId = scalafmtGroupId,
artifactId = scalafmtArtifactId,
Expand All @@ -99,7 +99,22 @@ object HookExecutor {
commitMessage = update => CommitMsg(s"Reformat with scalafmt ${update.nextVersion}"),
enabledByCache = _ => true,
enabledByConfig = _.scalafmt.runAfterUpgradingOrDefault
) ::
)

private val sbtJavaFormatterHook =
PostUpdateHook(
groupId = GroupId("com.lightbend.sbt"),
artifactId = ArtifactId("sbt-java-formatter"),
command = Nel.of("sbt", "javafmtAll"),
useSandbox = true,
commitMessage =
update => CommitMsg(s"Reformat with sbt-java-formatter ${update.nextVersion}"),
enabledByCache = _ => true,
enabledByConfig = _ => true
)

private val postUpdateHooks: List[PostUpdateHook] =
scalafmtHook :: sbtJavaFormatterHook ::
sbtGitHubActionsModules.map { case (gid, aid) =>
sbtGithubActionsHook(gid, aid, _ => true)
} ++
Expand Down

0 comments on commit c2b9977

Please sign in to comment.