mirror of https://github.com/sbt/sbt.git
Add sbt-houserules, formatting.
This commit is contained in:
parent
95b9239379
commit
6603a94847
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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] {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
@ -103,8 +103,7 @@ object Logic {
|
|||
checkAcyclic(clauses)
|
||||
|
||||
problem.toLeft(
|
||||
reduce0(clauses, initialFacts, Matched.empty)
|
||||
)
|
||||
reduce0(clauses, initialFacts, Matched.empty))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.1.0")
|
||||
Loading…
Reference in New Issue