File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,25 @@ lazy val sonatypeSetting = Def.settings(
2626
2727ThisBuild / scalafixDependencies += " com.github.liancheng" %% " organize-imports" % " 0.6.0"
2828
29+ // Add hook for scalafmt validation
30+ Global / onLoad ~= { old =>
31+ if (! scala.util.Properties .isWin) {
32+ import java .nio .file ._
33+ val prePush = Paths .get(" .git" , " hooks" , " pre-push" )
34+ Files .createDirectories(prePush.getParent)
35+ Files .write(
36+ prePush,
37+ """ #!/bin/sh
38+ |set -eux
39+ |bin/scalafmt --diff --diff-branch main
40+ |git diff --exit-code
41+ |""" .stripMargin.getBytes()
42+ )
43+ prePush.toFile.setExecutable(true )
44+ }
45+ old
46+ }
47+
2948val scalafixSettings : Seq [Setting [_]] = Seq (
3049 scalacOptions ++= {
3150 if (scalaVersion.value.startsWith(" 2.11" )) Seq (" -Ywarn-unused-import" )
You can’t perform that action at this time.
0 commit comments