Skip to content

Commit

Permalink
Reduce concurrency of scalafmtCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed May 13, 2019
1 parent 41100dd commit 6a3c988
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ ThisBuild / version := {
}
}
ThisBuild / licenses := List(("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0")))
ThisBuild / scalafmtOnCompile := true
ThisBuild / Test / scalafmtOnCompile := true
ThisBuild / scalafmtOnCompile := !(Global / insideCI).value
ThisBuild / Test / scalafmtOnCompile := !(Global / insideCI).value

def buildLevelSettings: Seq[Setting[_]] = Seq(
// https://github.com/sbt/sbt-git/issues/109
Expand Down
23 changes: 23 additions & 0 deletions project/FixScalafmtPlugin.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import sbt._
import Keys._
import org.scalafmt.sbt.ScalafmtPlugin
import ScalafmtPlugin.autoImport._

object FixScalafmtPlugin extends AutoPlugin {
override def requires = ScalafmtPlugin
override def trigger = allRequirements

val ScalaFmtTag = ConcurrentRestrictions.Tag("scalafmt")

override def globalSettings: Seq[Def.Setting[_]] =
Seq(
concurrentRestrictions += Tags.limit(ScalaFmtTag, 1)
)

override def projectSettings: Seq[Def.Setting[_]] =
Seq(
scalafmtCheckAll := (scalafmtCheckAll.tag(ScalaFmtTag)).value,
Compile / scalafmtCheck := ((Compile / scalafmtCheck).tag(ScalaFmtTag)).value,
Test / scalafmtCheck := ((Test / scalafmtCheck).tag(ScalaFmtTag)).value,
)
}

0 comments on commit 6a3c988

Please sign in to comment.