From 1d790de19cc8357c29bfb87ab4729c25c49b624e Mon Sep 17 00:00:00 2001 From: chick Date: Fri, 14 Aug 2020 10:31:52 -0700 Subject: Add control files for scala-fmt - .scalafmt.conf formatting rules - .travs.yml adds test that files are formatted to pass CI - .plugins.sbt add plugin for scalafmt --- .scalafmt.conf | 26 ++++++++++++++++++++++++++ .travis.yml | 6 ++++++ project/plugins.sbt | 2 ++ 3 files changed, 34 insertions(+) create mode 100644 .scalafmt.conf diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 00000000..f74e5504 --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,26 @@ +version = 2.6.4 + +maxColumn = 120 +align = most +continuationIndent.defnSite = 2 +assumeStandardLibraryStripMargin = true +docstrings = ScalaDoc +lineEndings = preserve +includeCurlyBraceInSelectChains = false +danglingParentheses = true + +align.tokens.add = [ + { + code = ":" + } +] + +newlines.alwaysBeforeCurlyBraceLambdaParams = false +newlines.alwaysBeforeMultilineDef = false +newlines.implicitParamListModifierForce = [before] + +verticalMultiline.atDefnSite = true + +optIn.annotationNewlines = true + +rewrite.rules = [SortImports, PreferCurlyFors, AvoidInfix] diff --git a/.travis.yml b/.travis.yml index 9163efa4..424d60c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,6 +58,12 @@ jobs: - utils/bin/firrtl.jar - project/project/ - project/target/ + - stage: test + name: "All files must be formatted with scalafmt" + workspaces: + use: firrtl_build + script: + - sbt scalafmtCheck - stage: test name: "Unidoc builds (no warnings)" workspaces: diff --git a/project/plugins.sbt b/project/plugins.sbt index 45d9425a..fb530385 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -22,4 +22,6 @@ addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.19") addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "3.0.0") +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0") + libraryDependencies += "com.github.os72" % "protoc-jar" % "3.11.4" -- cgit v1.2.3