aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Cervera <miguelcerverac@gmail.com>2017-10-17 15:44:11 -0700
committerGitHub <noreply@github.com>2017-10-17 15:44:11 -0700
commit602d5a54a9f4ced474a76f4106a1c5159405a4cf (patch)
tree5a15f780213c76b6bc660d4d34e45a8f183edf9e
parent586b5ad927b3bd3a414a634a04d4b92028cc3305 (diff)
downloadsbt-settings-602d5a54a9f4ced474a76f4106a1c5159405a4cf.tar.gz
sbt-settings-602d5a54a9f4ced474a76f4106a1c5159405a4cf.tar.bz2
sbt-settings-602d5a54a9f4ced474a76f4106a1c5159405a4cf.zip
Proposed scalafmt settings (#26)
-rw-r--r--src/main/resources/scalafmt.conf5
-rw-r--r--src/main/scala/xyz.driver.sbt/SbtSettings.scala34
2 files changed, 32 insertions, 7 deletions
diff --git a/src/main/resources/scalafmt.conf b/src/main/resources/scalafmt.conf
index 8a5d14f..e4f440d 100644
--- a/src/main/resources/scalafmt.conf
+++ b/src/main/resources/scalafmt.conf
@@ -9,7 +9,7 @@ maxColumn = 120
docstrings = ScalaDoc
continuationIndent.callSite = 2
-continuationIndent.defnSite = 8
+continuationIndent.defnSite = 4
rewriteTokens: {
"⇒" = "=>"
@@ -17,7 +17,8 @@ rewriteTokens: {
}
danglingParentheses = false
align.arrowEnumeratorGenerator = true
-align.openParenCallSite = true
+align.openParenCallSite = false
+align.openParenDefnSite = false
spaces.afterTripleEquals = true
spaces.inImportCurlyBraces = false
newlines.alwaysBeforeCurlyBraceLambdaParams = false
diff --git a/src/main/scala/xyz.driver.sbt/SbtSettings.scala b/src/main/scala/xyz.driver.sbt/SbtSettings.scala
index b500d4a..c98bb4c 100644
--- a/src/main/scala/xyz.driver.sbt/SbtSettings.scala
+++ b/src/main/scala/xyz.driver.sbt/SbtSettings.scala
@@ -39,20 +39,44 @@ object SbtSettings extends AutoPlugin {
}
Seq(
+ scalafmtVersion := "1.3.0",
resourceGenerators in Compile += generateScalafmtConfTask.taskValue,
+ // it:scalafmt -> runs scalafmt in src/it
+ scalafmt in IntegrationTest := {
+ // Explicit dependency to generating .scalafmt.conf file, otherwise there is no guarantee on execution order
+ (scalafmt in IntegrationTest).dependsOn(generateScalafmtConfTask).value
+ },
+ // test:scalafmt -> runs scalafmt in src/test + src/it
+ scalafmt in Test := {
+ // By transitive dependency Test depends on generateScalafmtConfTask. No need to explicitly add it here.
+ (scalafmt in Test).dependsOn(scalafmt in IntegrationTest).value
+ },
+ // scalafmt -> runs scalafmt in src/main + src/test + src/it
scalafmt in Compile := {
- generateScalafmtConfTask.value
- (scalafmt in Compile).value
+ // By transitive dependency Compile depends on generateScalafmtConfTask. No need to explicitly add it here.
+ (scalafmt in Compile).dependsOn(scalafmt in Test).value
+ },
+ // it:scalafmt::test -> tests scalafmt format in src/it
+ test in scalafmt in IntegrationTest := {
+ // Explicit dependency to generating .scalafmt.conf file, otherwise there is no guarantee on execution order
+ (test in scalafmt in IntegrationTest).dependsOn(generateScalafmtConfTask).value
+ },
+ // test:scalafmt::test -> tests scalafmt format in src/test + src/it
+ test in scalafmt in Test := {
+ // By transitive dependency Test depends on generateScalafmtConfTask. No need to explicitly add it here.
+ (test in scalafmt in Test).dependsOn(test in scalafmt in IntegrationTest).value
},
+ // scalafmt::test -> tests scalafmt format in src/main + src/test (added behavior)
test in scalafmt in Compile := {
- generateScalafmtConfTask.value
- (test in scalafmt in Compile).value
+ // By transitive dependency Compile depends on generateScalafmtConfTask. No need to explicitly add it here.
+ (test in scalafmt in Compile).dependsOn(test in scalafmt in Test).value
+
},
test in Test := {
(test in scalafmt in Compile).value
(test in Test).value
}
- )
+ ) ++ inConfig(IntegrationTest)(scalafmtSettings)
}
lazy val testScalastyle = taskKey[Unit]("testScalastyle")