Skip to content

Commit

Permalink
Add scalafmt (close #112)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjben committed Oct 29, 2020
1 parent 56966f9 commit 52016eb
Show file tree
Hide file tree
Showing 17 changed files with 745 additions and 524 deletions.
23 changes: 23 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version = "2.6.1"
style = default
align.preset = none
align.openParenCallSite = true
align.arrowEnumeratorGenerator = true
maxColumn = 140
docstrings = JavaDoc
optIn.breakChainOnFirstMethodDot = true
spaces.afterKeywordBeforeParen = true
continuationIndent.callSite = 2
continuationIndent.defnSite = 2
verticalMultiline.atDefnSite = true
verticalMultiline.arityThreshold = 3
verticalMultiline.newlineAfterOpenParen = true
verticalMultiline.newlineBeforeImplicitKW = true
verticalMultiline.excludeDanglingParens = []
importSelectors = noBinPack
rewrite.rules = [
AsciiSortImports,
RedundantBraces,
RedundantParens,
PreferCurlyFors
]
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ lazy val root = project.in(file("."))
.settings(BuildSettings.mimaSettings)
.settings(BuildSettings.scoverageSettings)
.settings(BuildSettings.sbtSiteSettings)
.settings(BuildSettings.formattingSettings)
.settings(Seq(
shellPrompt := { _ => name.value + " > " }
))
Expand Down
7 changes: 7 additions & 0 deletions project/BuildSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import com.typesafe.sbt.site.SiteScaladocPlugin.autoImport._
import com.typesafe.sbt.SbtGit.GitKeys.{gitBranch, gitRemoteRepo}
import com.typesafe.sbt.site.preprocess.PreprocessPlugin.autoImport._

import org.scalafmt.sbt.ScalafmtPlugin.autoImport._

object BuildSettings {

// Basic settings for our app
Expand Down Expand Up @@ -100,4 +102,9 @@ object BuildSettings {
siteSubdirName in SiteScaladoc := s"${version.value}",
preprocessVars in Preprocess := Map("VERSION" -> version.value)
)

lazy val formattingSettings = Seq(
scalafmtConfig := file(".scalafmt.conf"),
scalafmtOnCompile := false
)
}
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.0")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.2")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0")
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import com.snowplowanalytics.iglu.core.SchemaKey
object Data {

/**
* The type (contexts/derived_contexts/unstruct_event) and Iglu URI of a shredded type
*/
* The type (contexts/derived_contexts/unstruct_event) and Iglu URI of a shredded type
*/
case class ShreddedType(shredProperty: ShredProperty, schemaKey: SchemaKey)

/**
Expand All @@ -43,6 +43,7 @@ object Data {
* Field types of enriched event that can be shredded (self-describing JSONs)
*/
sealed trait ShredProperty {

/**
* Canonical field name
*/
Expand Down
Loading

0 comments on commit 52016eb

Please sign in to comment.