Merge pull request #4876 from eatkins/bump-scalafmt

Bump scalafmt
This commit is contained in:
eugene yokota 2019-07-18 16:05:01 -04:00 committed by GitHub
commit e1c7704e6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 114 additions and 119 deletions

View File

@ -1,4 +1,4 @@
version = 2.0.0-RC5
version = 2.0.0
maxColumn = 100
project.git = true
project.excludeFilters = [ "\\Wsbt-test\\W", "\\Winput_sources\\W", "\\Wcontraband-scala\\W" ]

View File

@ -135,8 +135,10 @@ object SettingsTest extends Properties("settings") {
forAll(mkAttrKeys[Int](2)) {
case List(key, derivedKey) =>
val projectKeys = for { proj <- 1 to nrProjects } yield ScopedKey(Scope(1, proj), key)
val projectDerivedKeys = for { proj <- 1 to nrProjects } yield
ScopedKey(Scope(1, proj), derivedKey)
val projectDerivedKeys = for { proj <- 1 to nrProjects } yield ScopedKey(
Scope(1, proj),
derivedKey
)
val globalKey = ScopedKey(Scope(0), key)
val globalDerivedKey = ScopedKey(Scope(0), derivedKey)
// Each project defines an initial value, but the update is defined in globalKey.

View File

@ -442,8 +442,9 @@ object Tests {
case _ => false
})
// TODO: To pass in correct explicitlySpecified and selectors
val tests = for ((df, di) <- discovered; fingerprint <- toFingerprints(di))
yield new TestDefinition(df.name, fingerprint, false, Array(new SuiteSelector))
val tests =
for ((df, di) <- discovered; fingerprint <- toFingerprints(di))
yield new TestDefinition(df.name, fingerprint, false, Array(new SuiteSelector))
val mains = discovered collect { case (df, di) if di.hasMain => df.name }
(tests, mains.toSet)
}

View File

@ -96,22 +96,21 @@ class CacheIvyTest extends Properties("CacheIvy") {
inclusions <- Gen.listOf(arbitrary[InclExclRule])
extraAttributes <- Gen.mapOf(arbitrary[(String, String)])
crossVersion <- arbitrary[CrossVersion]
} yield
ModuleID(
organization = o,
name = n,
revision = r,
configurations = cs,
isChanging = isChanging,
isTransitive = isTransitive,
isForce = isForce,
explicitArtifacts = explicitArtifacts.toVector,
inclusions = inclusions.toVector,
exclusions = exclusions.toVector,
extraAttributes = extraAttributes,
crossVersion = crossVersion,
branchName = branch
)
} yield ModuleID(
organization = o,
name = n,
revision = r,
configurations = cs,
isChanging = isChanging,
isTransitive = isTransitive,
isForce = isForce,
explicitArtifacts = explicitArtifacts.toVector,
inclusions = inclusions.toVector,
exclusions = exclusions.toVector,
extraAttributes = extraAttributes,
crossVersion = crossVersion,
branchName = branch
)
}
property("moduleIDFormat") = forAll { (m: ModuleID) =>

View File

@ -70,10 +70,9 @@ object BuildSettingsInstances {
20 -> AttributeMap.empty,
1 -> {
for (name <- Gen.identifier; isModule <- arbitrary[Boolean])
yield
AttributeMap.empty
.put(AttributeKey[String]("name"), name)
.put(AttributeKey[Boolean]("isModule"), isModule)
yield AttributeMap.empty
.put(AttributeKey[String]("name"), name)
.put(AttributeKey[Boolean]("isModule"), isModule)
}
)
}

View File

@ -3024,12 +3024,11 @@ object Classpaths {
val art = (artifact in packageBin).value
val module = projectID.value
val config = configuration.value
for { (f, analysis) <- trackedExportedProductsImplTask(track).value } yield
APIMappings
.store(analyzed(f, analysis), apiURL.value)
.put(artifact.key, art)
.put(moduleID.key, module)
.put(configuration.key, config)
for { (f, analysis) <- trackedExportedProductsImplTask(track).value } yield APIMappings
.store(analyzed(f, analysis), apiURL.value)
.put(artifact.key, art)
.put(moduleID.key, module)
.put(configuration.key, config)
}
private[sbt] def trackedExportedJarProducts(track: TrackLevel): Initialize[Task[Classpath]] =
Def.task {
@ -3037,12 +3036,11 @@ object Classpaths {
val art = (artifact in packageBin).value
val module = projectID.value
val config = configuration.value
for { (f, analysis) <- trackedJarProductsImplTask(track).value } yield
APIMappings
.store(analyzed(f, analysis), apiURL.value)
.put(artifact.key, art)
.put(moduleID.key, module)
.put(configuration.key, config)
for { (f, analysis) <- trackedJarProductsImplTask(track).value } yield APIMappings
.store(analyzed(f, analysis), apiURL.value)
.put(artifact.key, art)
.put(moduleID.key, module)
.put(configuration.key, config)
}
private[this] def trackedExportedProductsImplTask(
track: TrackLevel

View File

@ -584,19 +584,18 @@ object BuiltinCommands {
kvs = Act.keyValues(structure)(lastOnly_keys._2)
f <- if (lastOnly_keys._1) success(() => s)
else Aggregation.evaluatingParser(s, show)(kvs)
} yield
() => {
def export0(s: State): State = lastImpl(s, kvs, Some(ExportStream))
val newS = try f()
catch {
case NonFatal(e) =>
try export0(s)
finally {
throw e
}
}
export0(newS)
} yield () => {
def export0(s: State): State = lastImpl(s, kvs, Some(ExportStream))
val newS = try f()
catch {
case NonFatal(e) =>
try export0(s)
finally {
throw e
}
}
export0(newS)
}
}
def lastGrepParser(s: State): Parser[(String, Option[AnyKeys])] =

View File

@ -267,8 +267,9 @@ object Plugins extends PluginsFunctions {
private[this] def duplicateProvidesError(byAtom: Seq[(Atom, AutoPlugin)]): Unit = {
val dupsByAtom = byAtom.groupBy(_._1).mapValues(_.map(_._2))
val dupStrings = for ((atom, dups) <- dupsByAtom if dups.size > 1)
yield s"${atom.label} by ${dups.mkString(", ")}"
val dupStrings =
for ((atom, dups) <- dupsByAtom if dups.size > 1)
yield s"${atom.label} by ${dups.mkString(", ")}"
val (ns, nl) = if (dupStrings.size > 1) ("s", "\n\t") else ("", " ")
val message = s"Plugin$ns provided by multiple AutoPlugins:$nl${dupStrings.mkString(nl)}"
throw AutoPluginException(message)

View File

@ -89,15 +89,14 @@ object Act {
def globalKey =
for {
g <- globalIdent
} yield
taskKeyExtra(
index,
defaultConfigs,
keyMap,
None,
ParsedZero,
ScopeMask(true, true, false, false)
)
} yield taskKeyExtra(
index,
defaultConfigs,
keyMap,
None,
ParsedZero,
ScopeMask(true, true, false, false)
)
globalKey | fullKey
}
@ -112,16 +111,15 @@ object Act {
): Seq[Parser[ParsedKey]] =
for {
conf <- configs(confAmb, defaultConfigs, proj, index)
} yield
for {
taskAmb <- taskAxis(index.tasks(proj, conf), keyMap)
task = resolveTask(taskAmb)
key <- key(index, proj, conf, task, keyMap)
extra <- extraAxis(keyMap, IMap.empty)
} yield {
val mask = baseMask.copy(task = taskAmb.isExplicit, extra = true)
new ParsedKey(makeScopedKey(proj, conf, task, extra, key), mask)
}
} yield for {
taskAmb <- taskAxis(index.tasks(proj, conf), keyMap)
task = resolveTask(taskAmb)
key <- key(index, proj, conf, task, keyMap)
extra <- extraAxis(keyMap, IMap.empty)
} yield {
val mask = baseMask.copy(task = taskAmb.isExplicit, extra = true)
new ParsedKey(makeScopedKey(proj, conf, task, extra, key), mask)
}
def makeScopedKey(
proj: Option[ResolvedReference],

View File

@ -195,8 +195,9 @@ object Aggregation {
inputs: Values[InputTask[I]],
show: ShowConfig
)(implicit display: Show[ScopedKey[_]]): Parser[() => State] = {
val parsers = for (KeyValue(k, it) <- inputs)
yield it.parser(s).map(v => KeyValue(k, v))
val parsers =
for (KeyValue(k, it) <- inputs)
yield it.parser(s).map(v => KeyValue(k, v))
Command.applyEffect(seq(parsers)) { roots =>
runTasks(s, roots, DummyTaskMap(Nil), show)
}

View File

@ -176,11 +176,10 @@ object BuildLoader {
resolve <- cs.resolver(new ResolveInfo(uri, staging, config, state))
base = resolve()
build <- cs.builder(new BuildInfo(uri, base, config, state))
} yield
() => {
val unit = build()
cs.transformer(new TransformInfo(uri, base, unit, config, state))
}
} yield () => {
val unit = build()
cs.transformer(new TransformInfo(uri, base, unit, config, state))
}
}
}

View File

@ -149,8 +149,7 @@ private[sbt] object SettingCompletions {
defineKey <- scopedKeyParser(keyMap, settings, context)
a <- assign(defineKey)
_ <- valueParser(defineKey, a)
} yield
() // parser is currently only for completion and the parsed data structures are not used
} yield () // parser is currently only for completion and the parsed data structures are not used
matched(full) | any.+.string
}

View File

@ -98,11 +98,10 @@ abstract class TestBuild {
// task axis of Scope is set to Zero and the value of the second map is the original task axis
val taskAxesMappings =
for ((scope, keys) <- data.data.toIterable; key <- keys.keys)
yield
(ScopedKey(scope.copy(task = Zero), key), scope.task): (
ScopedKey[_],
ScopeAxis[AttributeKey[_]]
)
yield (ScopedKey(scope.copy(task = Zero), key), scope.task): (
ScopedKey[_],
ScopeAxis[AttributeKey[_]]
)
val taskAxes = Relation.empty ++ taskAxesMappings
val zero = new HashSet[ScopedKey[_]]
@ -369,8 +368,9 @@ abstract class TestBuild {
names match {
case Vector() => sequence(acc)
case Vector(x, xs @ _*) =>
val next = for (depCount <- maxDeps; d <- pick(depCount min xs.size, xs))
yield (x, d.toVector)
val next =
for (depCount <- maxDeps; d <- pick(depCount min xs.size, xs))
yield (x, d.toVector)
genAcyclic(maxDeps, xs.toVector, next +: acc)
}
def sequence[T](gs: Vector[Gen[T]]): Gen[Vector[T]] = Gen.parameterized { prms =>

View File

@ -112,40 +112,39 @@ class JUnitXmlTestsListener(val outputDir: String, logger: Logger) extends Tests
{properties}
{
for (e <- events)
yield
<testcase classname={name} name={
e.selector match {
case selector: TestSelector => selector.testName.split('.').last
case nested: NestedTestSelector =>
nested.suiteId().split('.').last + "." + nested.testName()
case other => s"(It is not a test it is a ${other.getClass.getCanonicalName})"
}
} time={(e.duration() / 1000.0).toString}>
{
val trace: String = if (e.throwable.isDefined) {
val stringWriter = new StringWriter()
val writer = new PrintWriter(stringWriter)
e.throwable.get.printStackTrace(writer)
writer.flush()
stringWriter.toString
} else {
""
}
e.status match {
case TStatus.Error if (e.throwable.isDefined) =>
<error message={e.throwable.get.getMessage} type={
e.throwable.get.getClass.getName
}>{trace}</error>
case TStatus.Error => <error message={"No Exception or message provided"}/>
case TStatus.Failure if (e.throwable.isDefined) =>
<failure message={e.throwable.get.getMessage} type={
e.throwable.get.getClass.getName
}>{trace}</failure>
case TStatus.Failure => <failure message={"No Exception or message provided"}/>
case TStatus.Ignored | TStatus.Skipped | TStatus.Pending => <skipped/>
case _ => {}
}
yield <testcase classname={name} name={
e.selector match {
case selector: TestSelector => selector.testName.split('.').last
case nested: NestedTestSelector =>
nested.suiteId().split('.').last + "." + nested.testName()
case other => s"(It is not a test it is a ${other.getClass.getCanonicalName})"
}
} time={(e.duration() / 1000.0).toString}>
{
val trace: String = if (e.throwable.isDefined) {
val stringWriter = new StringWriter()
val writer = new PrintWriter(stringWriter)
e.throwable.get.printStackTrace(writer)
writer.flush()
stringWriter.toString
} else {
""
}
e.status match {
case TStatus.Error if (e.throwable.isDefined) =>
<error message={e.throwable.get.getMessage} type={
e.throwable.get.getClass.getName
}>{trace}</error>
case TStatus.Error => <error message={"No Exception or message provided"}/>
case TStatus.Failure if (e.throwable.isDefined) =>
<failure message={e.throwable.get.getMessage} type={
e.throwable.get.getClass.getName
}>{trace}</failure>
case TStatus.Failure => <failure message={"No Exception or message provided"}/>
case TStatus.Ignored | TStatus.Skipped | TStatus.Pending => <skipped/>
case _ => {}
}
}
</testcase>
}