diff --git a/.scalafmt.conf b/.scalafmt.conf index e4ab36511..718ce5aed 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,3 +1,4 @@ +version = 2.0.0-RC6 maxColumn = 100 project.git = true project.excludeFilters = [ /sbt-test/, /input_sources/, /contraband-scala/ ] @@ -8,3 +9,13 @@ docstrings = JavaDoc # This also seems more idiomatic to include whitespace in import x.{ yyy } spaces.inImportCurlyBraces = true + +# This is more idiomatic Scala. +# http://docs.scala-lang.org/style/indentation.html#methods-with-numerous-arguments +align.openParenCallSite = false +align.openParenDefnSite = false + +# For better code clarity +danglingParentheses = true + +trailingCommas = preserve diff --git a/.travis.yml b/.travis.yml index bdcda90eb..714aaabaf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,7 +42,7 @@ install: script: sbt -Dfile.encoding=UTF8 ++$TRAVIS_SCALA_VERSION! mimaReportBinaryIssues - scalafmt::test test:scalafmt::test sbt:scalafmt::test + scalafmtCheckAll whitesourceCheckPolicies test scriptedIvy diff --git a/build.sbt b/build.sbt index b1fb5d3dc..4b71318ee 100644 --- a/build.sbt +++ b/build.sbt @@ -29,6 +29,8 @@ def commonSettings: Seq[Setting[_]] = Def.settings( } }, inCompileAndTest(scalacOptions in console --= Vector("-Ywarn-unused-import", "-Ywarn-unused", "-Xlint")), + scalafmtOnCompile := true, + Test / scalafmtOnCompile := true, publishArtifact in Compile := true, publishArtifact in Test := false, parallelExecution in Test := false @@ -57,7 +59,6 @@ lazy val lmRoot = (project in file(".")) Some(ScmInfo(url(s"https://github.com/$slug"), s"git@github.com:$slug.git")) }, bintrayPackage := "librarymanagement", - scalafmtOnCompile in Sbt := false, git.baseVersion := "1.3.0", version := { val v = version.value diff --git a/project/plugins.sbt b/project/plugins.sbt index 932866622..3794c4ca6 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ -addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.8") -addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.15") +addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.9") +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.0") addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.4.2") -addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.9") +addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.14") scalacOptions += "-language:postfixOps"