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 @@ -13,6 +13,25 @@ ThisBuild / bloopExportJarClassifiers := Some(Set("sources"))
13
13
14
14
ThisBuild / scalafixDependencies += " com.github.liancheng" %% " organize-imports" % " 0.6.0"
15
15
16
+ // Add hook for scalafmt validation
17
+ Global / onLoad ~= { old =>
18
+ if (! scala.util.Properties .isWin) {
19
+ import java .nio .file ._
20
+ val prePush = Paths .get(" .git" , " hooks" , " pre-push" )
21
+ Files .createDirectories(prePush.getParent)
22
+ Files .write(
23
+ prePush,
24
+ """ #!/bin/sh
25
+ |set -eux
26
+ |bin/scalafmt --diff --diff-branch main
27
+ |git diff --exit-code
28
+ |""" .stripMargin.getBytes()
29
+ )
30
+ prePush.toFile.setExecutable(true )
31
+ }
32
+ old
33
+ }
34
+
16
35
val scalafixSettings : Seq [Setting [_]] = Seq (
17
36
scalacOptions ++= {
18
37
if (scalaVersion.value.startsWith(" 2.11" )) Seq (" -Ywarn-unused-import" )
You can’t perform that action at this time.
0 commit comments