Add sbt-houserules, formatting.

This commit is contained in:
Martin Duhem 2015-08-31 10:55:02 +02:00
parent 95b9239379
commit 6603a94847
9 changed files with 16 additions and 28 deletions

View File

@ -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.

View File

@ -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)
}

View File

@ -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)

View File

@ -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.

View File

@ -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] {

View File

@ -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)
}

View File

@ -103,8 +103,7 @@ object Logic {
checkAcyclic(clauses)
problem.toLeft(
reduce0(clauses, initialFacts, Matched.empty)
)
reduce0(clauses, initialFacts, Matched.empty))
}
/**

View File

@ -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

1
project/p.sbt Normal file
View File

@ -0,0 +1 @@
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.1.0")