From 0406ab60ab9aaba3c20bc4065a13cfe7e5a5be92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Krzewski?= Date: Tue, 23 Feb 2016 00:16:44 +0100 Subject: [PATCH] Automated source formatting using sbt-scalariform --- build.sbt | 13 ++++++++++++- project/plugins.sbt | 4 +++- scalariform.properties | 22 ++++++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 scalariform.properties diff --git a/build.sbt b/build.sbt index 846e121..ff5e167 100644 --- a/build.sbt +++ b/build.sbt @@ -1,9 +1,20 @@ scalaVersion := "2.11.7" +import com.typesafe.sbt.SbtScalariform.ScalariformKeys + +val scalariformPrefs = { + import java.util.Properties + import scalariform.formatter.preferences._ + val props = new Properties() + IO.load(props, file("scalariform.properties")) + PreferencesImporterExporter.getPreferences(props) +} + lazy val commonSettings = Seq( version := "0.1.0", organization := "pl.caltha", - scalaVersion := "2.11.7" + scalaVersion := "2.11.7", + ScalariformKeys.preferences := scalariformPrefs ) val akkaVersion = "2.4.2" diff --git a/project/plugins.sbt b/project/plugins.sbt index 8d49e4e..d230ed4 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -11,4 +11,6 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7") addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0") addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.0") -addSbtPlugin("io.spray" % "sbt-revolver" % "0.7.2") \ No newline at end of file +addSbtPlugin("io.spray" % "sbt-revolver" % "0.7.2") + +addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.6.0") diff --git a/scalariform.properties b/scalariform.properties new file mode 100644 index 0000000..c8611f8 --- /dev/null +++ b/scalariform.properties @@ -0,0 +1,22 @@ +alignParameters=true +alignSingleLineCaseStatements=false +alignSingleLineCaseStatements.maxArrowIndent=40 +compactControlReadability=false +compactStringConcatenation=false +danglingCloseParenthesis=prevent +doubleIndentClassDeclaration=true +formatXml=true +indentLocalDefs=false +indentPackageBlocks=true +indentSpaces=2 +indentWithTabs=false +multilineScaladocCommentsStartOnFirstLine=false +placeScaladocAsterisksBeneathSecondAsterisk=true +preserveDanglingCloseParenthesis=false +preserveSpaceBeforeArguments=false +rewriteArrowSymbols=true +spacesAroundMultiImports=false +spaceBeforeColon=false +spaceInsideBrackets=false +spaceInsideParentheses=false +spacesWithinPatternBinders=true