From 6603a948474be2fa562e47fa521b568100ce9c83 Mon Sep 17 00:00:00 2001 From: Martin Duhem Date: Mon, 31 Aug 2015 10:55:02 +0200 Subject: [PATCH] Add sbt-houserules, formatting. --- .../src/test/scala/SettingsExample.scala | 3 +-- .../src/test/scala/SettingsTest.scala | 9 +++------ .../scala/sbt/complete/HistoryCommands.scala | 3 +-- .../src/main/scala/sbt/complete/TypeString.scala | 3 +-- .../sbt/complete/ParserWithExamplesTest.scala | 16 ++++++---------- .../src/main/scala/sbt/ExitHook.scala | 3 +-- .../src/main/scala/sbt/logic/Logic.scala | 3 +-- .../src/test/scala/sbt/logic/Test.scala | 3 +-- project/p.sbt | 1 + 9 files changed, 16 insertions(+), 28 deletions(-) create mode 100644 project/p.sbt diff --git a/internal/util-collection/src/test/scala/SettingsExample.scala b/internal/util-collection/src/test/scala/SettingsExample.scala index b48bb27fc..3a6bc3853 100644 --- a/internal/util-collection/src/test/scala/SettingsExample.scala +++ b/internal/util-collection/src/test/scala/SettingsExample.scala @@ -49,8 +49,7 @@ object SettingsUsage { val mySettings: Seq[Setting[_]] = Seq( setting(a3, value(3)), setting(b4, map(a4)(_ * 3)), - update(a5)(_ + 1) - ) + update(a5)(_ + 1)) // "compiles" and applies the settings. // This can be split into multiple steps to access intermediate results if desired. diff --git a/internal/util-collection/src/test/scala/SettingsTest.scala b/internal/util-collection/src/test/scala/SettingsTest.scala index d97b1056a..ab92332db 100644 --- a/internal/util-collection/src/test/scala/SettingsTest.scala +++ b/internal/util-collection/src/test/scala/SettingsTest.scala @@ -55,8 +55,7 @@ object SettingsTest extends Properties("settings") { List(scoped0, scoped1) <- chk :: scopedKeys sliding 2 nextInit = if (scoped0 == chk) chk else (scoped0 zipWith chk) { (p, _) => p + 1 } - } yield derive(setting(scoped1, nextInit)) - ).toSeq + } yield derive(setting(scoped1, nextInit))).toSeq { // Note: This causes a cycle refernec error, quite frequently. @@ -96,8 +95,7 @@ object SettingsTest extends Properties("settings") { setting(b, value(6)), derive(setting(b, a)), setting(a, value(5)), - setting(b, value(8)) - ) + setting(b, value(8))) val ev = evaluate(settings) checkKey(a, Some(5), ev) && checkKey(b, Some(8), ev) } @@ -106,8 +104,7 @@ object SettingsTest extends Properties("settings") { setting(a, value(3)), setting(b, value(6)), derive(setting(b, a)), - setting(a, value(5)) - ) + setting(a, value(5))) val ev = evaluate(settings) checkKey(a, Some(5), ev) && checkKey(b, Some(5), ev) } diff --git a/internal/util-complete/src/main/scala/sbt/complete/HistoryCommands.scala b/internal/util-complete/src/main/scala/sbt/complete/HistoryCommands.scala index c82ecfa3d..ff58fe9d2 100644 --- a/internal/util-complete/src/main/scala/sbt/complete/HistoryCommands.scala +++ b/internal/util-complete/src/main/scala/sbt/complete/HistoryCommands.scala @@ -34,8 +34,7 @@ object HistoryCommands { Nth -> ("Execute the command with index n, as shown by the " + ListFull + " command"), Previous -> "Execute the nth command before this one", StartsWithString -> "Execute the most recent command starting with 'string'", - ContainsString -> "Execute the most recent command containing 'string'" - ) + ContainsString -> "Execute the most recent command containing 'string'") def helpString = "History commands:\n " + (descriptions.map { case (c, d) => c + " " + d }).mkString("\n ") def printHelp(): Unit = println(helpString) diff --git a/internal/util-complete/src/main/scala/sbt/complete/TypeString.scala b/internal/util-complete/src/main/scala/sbt/complete/TypeString.scala index 6bf89ac05..bd5f84f43 100644 --- a/internal/util-complete/src/main/scala/sbt/complete/TypeString.scala +++ b/internal/util-complete/src/main/scala/sbt/complete/TypeString.scala @@ -61,8 +61,7 @@ private[sbt] object TypeString { val TypeMap = Map( "java.io.File" -> "File", "java.net.URL" -> "URL", - "java.net.URI" -> "URI" - ) + "java.net.URI" -> "URI") /** * A Parser that extracts basic structure from the string representation of a type from Manifest.toString. diff --git a/internal/util-complete/src/test/scala/sbt/complete/ParserWithExamplesTest.scala b/internal/util-complete/src/test/scala/sbt/complete/ParserWithExamplesTest.scala index dff68803c..3bcc55dd2 100644 --- a/internal/util-complete/src/test/scala/sbt/complete/ParserWithExamplesTest.scala +++ b/internal/util-complete/src/test/scala/sbt/complete/ParserWithExamplesTest.scala @@ -17,8 +17,7 @@ class ParserWithExamplesTest extends Specification { "use the delegate parser to remove invalid examples" in new parserWithValidExamples { val validCompletions = Completions(Set( suggestion("blue"), - suggestion("red") - )) + suggestion("red"))) parserWithExamples.completions(0) shouldEqual validCompletions } } @@ -26,8 +25,7 @@ class ParserWithExamplesTest extends Specification { "listing valid completions in a derived parser" should { "produce only valid examples that start with the character of the derivation" in new parserWithValidExamples { val derivedCompletions = Completions(Set( - suggestion("lue") - )) + suggestion("lue"))) parserWithExamples.derive('b').completions(0) shouldEqual derivedCompletions } } @@ -43,8 +41,7 @@ class ParserWithExamplesTest extends Specification { "produce only examples that start with the character of the derivation" in new parserWithAllExamples { val derivedCompletions = Completions(Set( suggestion("lue"), - suggestion("lock") - )) + suggestion("lock"))) parserWithExamples.derive('b').completions(0) shouldEqual derivedCompletions } } @@ -56,8 +53,8 @@ class ParserWithExamplesTest extends Specification { class parserWithAllExamples extends parser(removeInvalidExamples = false) case class parser(examples: Iterable[String] = Set("blue", "yellow", "greeen", "block", "red"), - maxNumberOfExamples: Int = 25, - removeInvalidExamples: Boolean) extends Scope { + maxNumberOfExamples: Int = 25, + removeInvalidExamples: Boolean) extends Scope { import DefaultParsers._ @@ -66,8 +63,7 @@ class ParserWithExamplesTest extends Specification { colorParser, FixedSetExamples(examples), maxNumberOfExamples, - removeInvalidExamples - ) + removeInvalidExamples) } case class GrowableSourceOfExamples() extends Iterable[String] { diff --git a/internal/util-control/src/main/scala/sbt/ExitHook.scala b/internal/util-control/src/main/scala/sbt/ExitHook.scala index 8ee5ddf86..16f295c7c 100644 --- a/internal/util-control/src/main/scala/sbt/ExitHook.scala +++ b/internal/util-control/src/main/scala/sbt/ExitHook.scala @@ -16,6 +16,5 @@ object ExitHooks { /** Calls each registered exit hook, trapping any exceptions so that each hook is given a chance to run. */ def runExitHooks(exitHooks: Seq[ExitHook]): Seq[Throwable] = exitHooks.flatMap(hook => - ErrorHandling.wideConvert(hook.runBeforeExiting()).left.toOption - ) + ErrorHandling.wideConvert(hook.runBeforeExiting()).left.toOption) } \ No newline at end of file diff --git a/internal/util-logic/src/main/scala/sbt/logic/Logic.scala b/internal/util-logic/src/main/scala/sbt/logic/Logic.scala index 856394251..0fbbe3f98 100644 --- a/internal/util-logic/src/main/scala/sbt/logic/Logic.scala +++ b/internal/util-logic/src/main/scala/sbt/logic/Logic.scala @@ -103,8 +103,7 @@ object Logic { checkAcyclic(clauses) problem.toLeft( - reduce0(clauses, initialFacts, Matched.empty) - ) + reduce0(clauses, initialFacts, Matched.empty)) } /** diff --git a/internal/util-logic/src/test/scala/sbt/logic/Test.scala b/internal/util-logic/src/test/scala/sbt/logic/Test.scala index f62a9e767..da1f0b706 100644 --- a/internal/util-logic/src/test/scala/sbt/logic/Test.scala +++ b/internal/util-logic/src/test/scala/sbt/logic/Test.scala @@ -20,8 +20,7 @@ object LogicTest extends Properties("Logic") { case Right(res) => false case Left(err: Logic.CyclicNegation) => true case Left(err) => sys.error(s"Expected cyclic error, got: $err") - } - ) + }) def expect(result: Either[LogicException, Matched], expected: Set[Atom]) = result match { case Left(err) => false diff --git a/project/p.sbt b/project/p.sbt new file mode 100644 index 000000000..eefc29672 --- /dev/null +++ b/project/p.sbt @@ -0,0 +1 @@ +addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.1.0")