Skip to content

Commit

Permalink
Spark Enrich: use automated code formatting (closes #3654)
Browse files Browse the repository at this point in the history
  • Loading branch information
knservis committed Mar 23, 2018
1 parent 883e12e commit a66d72e
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
30 changes: 30 additions & 0 deletions 3-enrich/spark-enrich/.scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
style = defaultWithAlign
maxColumn = 100

docstrings = JavaDoc
optIn.breakChainOnFirstMethodDot = true
spaces.afterKeywordBeforeParen = true
continuationIndent.defnSite = 2
continuationIndent.callSite = 2
importSelectors = noBinPack

newlines {
sometimesBeforeColonInMethodReturnType = false
}

align {
arrowEnumeratorGenerator = false
ifWhileOpenParen = false
openParenCallSite = false
openParenDefnSite = false
}

rewrite {
rules = [
AsciiSortImports,
RedundantBraces,
RedundantParens,
PreferCurlyFors
]
redundantBraces.maxLines = 1
}
1 change: 1 addition & 0 deletions 3-enrich/spark-enrich/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ lazy val root = project.in(file("."))
version := "1.12.0",
description := "The Snowplow Spark Enrichment process"
)
.settings(BuildSettings.formatting)
.settings(BuildSettings.buildSettings)
.settings(BuildSettings.sbtAssemblySettings)
.settings(
Expand Down
9 changes: 9 additions & 0 deletions 3-enrich/spark-enrich/project/BuildSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
import sbt._
import Keys._

// Scalafmt plugin
import com.lucidchart.sbt.scalafmt.ScalafmtPlugin._
import com.lucidchart.sbt.scalafmt.ScalafmtCorePlugin.autoImport._

object BuildSettings {

// Basic settings for our app
Expand Down Expand Up @@ -82,4 +86,9 @@ object BuildSettings {
oldStrategy(x)
}
)
lazy val formatting = Seq(
scalafmtConfig := file(".scalafmt.conf"),
scalafmtOnCompile := true,
scalafmtVersion := "1.3.0"
)
}
4 changes: 4 additions & 0 deletions 3-enrich/spark-enrich/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.3")

addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.1")

addSbtPlugin("com.lucidchart" % "sbt-scalafmt-coursier" % "1.14")

0 comments on commit a66d72e

Please sign in to comment.