Skip to content

Commit

Permalink
Add scalafmt (closes #128)
Browse files Browse the repository at this point in the history
  • Loading branch information
asoltysik committed Sep 18, 2018
1 parent 6cbbf9c commit d20e095
Show file tree
Hide file tree
Showing 22 changed files with 377 additions and 372 deletions.
15 changes: 15 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
style = default
align = some
maxColumn = 120
docstrings = JavaDoc
optIn.breakChainOnFirstMethodDot = true
spaces.afterKeywordBeforeParen = true
continuationIndent.defnSite = 2
importSelectors = noBinPack
rewrite.rules = [
AsciiSortImports,
RedundantBraces,
RedundantParens,
PreferCurlyFors
]
align.tokens = ["|", "!", "!!", "||", "=>", "=", "->", "<-", "|@|", "//", "/", "+"]
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ lazy val root = project.in(file("."))
)
.settings(BuildSettings.buildSettings)
.settings(BuildSettings.publishSettings)
.settings(BuildSettings.formattingSettings)
.settings(
libraryDependencies ++= Seq(
Dependencies.Libraries.jodaTime,
Expand Down
7 changes: 7 additions & 0 deletions project/BuildSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import Keys._
import bintray.BintrayPlugin._
import bintray.BintrayKeys._

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

object BuildSettings {

// Basic settings for our app
Expand Down Expand Up @@ -66,4 +69,8 @@ object BuildSettings {
</developer>
</developers>)
)

lazy val formattingSettings = Seq(
scalafmtOnCompile := true
)
}
2 changes: 2 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.4")

addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.5.1")
Loading

0 comments on commit d20e095

Please sign in to comment.