Skip to content

Commit

Permalink
2: State: indicate if all alternatives were newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert Meltzer committed Jul 19, 2020
1 parent c8f87fe commit cbfbeb8
Show file tree
Hide file tree
Showing 68 changed files with 170 additions and 266 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ object FileToEvents extends Logging {
mode = "Import",
batch = "App ID " + args.appId + channelStr,
executorEnv = Runner.envStringToMap(args.env))
val rdd = sc.textFile(args.inputPath).filter(_.trim.nonEmpty).map {
json =>
val rdd =
sc.textFile(args.inputPath).filter(_.trim.nonEmpty).map { json =>
Try(read[Event](json)).recoverWith {
case e: Throwable =>
error(s"\nmalformed json => $json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ private[akka] class ClusterJmx(cluster: Cluster, log: LoggingAdapter) {
// JMX attributes (bean-style)

def getClusterStatus: String = {
val members = clusterView.members.toSeq.sorted(Member.ordering).map {
m
val members =
clusterView.members.toSeq.sorted(Member.ordering).map { m
s"""{
| "address": "${m.address}",
| "status": "${m.status}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,7 @@ class FlowGraphDocSpec extends AkkaSpec {
// This cannot produce any value:
val cyclicFold: Source[Int, Future[Int]] =
Source.fromGraph(GraphDSL.create(Sink.fold[Int, Int](0)(_ + _)) {
implicit builder =>
fold =>
implicit builder => fold =>
// - Fold cannot complete until its upstream mapAsync completes
// - mapAsync cannot complete until the materialized Future produced by
// fold completes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,9 @@ private[persistence] trait LeveldbStore

val result = Future.fromTry(Try {
withBatch(batch
messages.map {
a
messages.map { a
Try {
a.payload.foreach {
p
a.payload.foreach { p
val (p2, tags) = p.payload match {
case Tagged(payload, tags)
(p.withPayload(payload), tags)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ class GraphBroadcastSpec extends AkkaSpec {
headSink,
headSink
)(combine) {
implicit b
(
implicit b (
p1,
p2,
p3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ class ReceptionistSpec extends TypedSpec {

def `must work with ask`(): Unit =
sync(runTest("Receptionist") {
StepWise[Registered[ServiceA]] {
(ctx, startWith)
StepWise[Registered[ServiceA]] { (ctx, startWith)
val self = ctx.self
import system.executionContext
startWith
Expand Down
6 changes: 2 additions & 4 deletions repos/akka/project/ValidatePullRequest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ object ValidatePullRequest extends AutoPlugin {
},
buildAllKeyword in Global in ValidatePR := """PLS BUILD ALL""".r,
githubEnforcedBuildAll in Global in ValidatePR := {
sys.env.get(PullIdEnvVarName).map(_.toInt) flatMap {
prId =>
sys.env.get(PullIdEnvVarName).map(_.toInt) flatMap { prId =>
val log = streams.value.log
val buildAllMagicPhrase = (buildAllKeyword in ValidatePR).value
log.info("Checking GitHub comments for PR validation options...")
Expand All @@ -166,8 +165,7 @@ object ValidatePullRequest extends AutoPlugin {
}
} catch {
case ex: Exception =>
log.warn(
"Unable to reach GitHub! Exception was: " + ex.getMessage)
log.warn("Unable to reach GitHub! Exception was: " + ex.getMessage)
None
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ private object JmDNSResolver {
def serviceResolved(event: ServiceEvent) {}

def serviceAdded(event: ServiceEvent) {
DNS.getServiceInfo(event.getType, event.getName) foreach {
info =>
DNS.getServiceInfo(event.getType, event.getName) foreach { info =>
val addresses = info.getInetAddresses
val metadata = MdnsAddrMetadata(
info.getName,
Expand Down Expand Up @@ -108,8 +107,7 @@ private class JmDNSGroup(regType: String) extends Group[Address] {
def serviceResolved(event: ServiceEvent) {}

def serviceAdded(event: ServiceEvent) {
DNS.getServiceInfo(event.getType, event.getName) foreach {
info =>
DNS.getServiceInfo(event.getType, event.getName) foreach { info =>
val addresses = info.getInetAddresses
val metadata = MdnsAddrMetadata(
info.getName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ object Extraction {
JField(unmangleName(name), decompose(f get x))
} match {
case args =>
val fields = formats.fieldSerializer(x.getClass).map {
serializer =>
val fields =
formats.fieldSerializer(x.getClass).map { serializer =>
Reflection.fields(x.getClass).map {
case (mangledName, _) =>
val n = Meta.unmangleName(mangledName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ trait AccountControllerBase extends AccountManagementControllerBase {

post("/:userName/_edit", editForm)(oneselfOnly { form =>
val userName = params("userName")
getAccountByUserName(userName).map {
account =>
getAccountByUserName(userName).map { account =>
updateAccount(
account.copy(
password = form.password.map(sha1).getOrElse(account.password),
Expand All @@ -257,8 +256,7 @@ trait AccountControllerBase extends AccountManagementControllerBase {
get("/:userName/_delete")(oneselfOnly {
val userName = params("userName")

getAccountByUserName(userName, true).foreach {
account =>
getAccountByUserName(userName, true).foreach { account =>
// // Remove repositories
// getRepositoryNamesOfUser(userName).foreach { repositoryName =>
// deleteRepository(userName, repositoryName)
Expand Down Expand Up @@ -299,8 +297,7 @@ trait AccountControllerBase extends AccountManagementControllerBase {

get("/:userName/_application")(oneselfOnly {
val userName = params("userName")
getAccountByUserName(userName).map {
x =>
getAccountByUserName(userName).map { x =>
var tokens = getAccessTokens(x.userName)
val generatedToken = flash.get("generatedToken") match {
case Some((tokenId: Int, token: String)) => {
Expand Down Expand Up @@ -387,20 +384,16 @@ trait AccountControllerBase extends AccountManagementControllerBase {
})

get("/:groupName/_deletegroup")(managersOnly {
defining(params("groupName")) {
groupName =>
defining(params("groupName")) { groupName =>
// Remove from GROUP_MEMBER
updateGroupMembers(groupName, Nil)
// Remove repositories
getRepositoryNamesOfUser(groupName).foreach {
repositoryName =>
getRepositoryNamesOfUser(groupName).foreach { repositoryName =>
deleteRepository(groupName, repositoryName)
FileUtils.deleteDirectory(
getRepositoryDir(groupName, repositoryName))
FileUtils.deleteDirectory(getRepositoryDir(groupName, repositoryName))
FileUtils.deleteDirectory(
getWikiRepositoryDir(groupName, repositoryName))
FileUtils.deleteDirectory(
getTemporaryDir(groupName, repositoryName))
FileUtils.deleteDirectory(getTemporaryDir(groupName, repositoryName))
}
}
redirect("/")
Expand All @@ -418,8 +411,7 @@ trait AccountControllerBase extends AccountManagementControllerBase {
}
.toList) {
case (groupName, members) =>
getAccountByUserName(groupName, true).map {
account =>
getAccountByUserName(groupName, true).map { account =>
updateGroup(groupName, form.url, false)

// Update GROUP_MEMBER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,10 @@ trait ApiControllerBase extends ControllerBase {
repository =>
val owner = repository.owner
val name = repository.name
params("id").toIntOpt.flatMap {
issueId =>
params("id").toIntOpt.flatMap { issueId =>
getPullRequest(owner, name, issueId) map {
case (issue, pullreq) =>
using(Git.open(getRepositoryDir(owner, name))) {
git =>
using(Git.open(getRepositoryDir(owner, name))) { git =>
val oldId = git.getRepository.resolve(pullreq.commitIdFrom)
val newId = git.getRepository.resolve(pullreq.commitIdTo)
val repoFullName = RepositoryName(repository)
Expand All @@ -409,8 +407,7 @@ trait ApiControllerBase extends ControllerBase {
.call
.iterator
.asScala
.map(c =>
ApiCommitListItem(new CommitInfo(c), repoFullName))
.map(c => ApiCommitListItem(new CommitInfo(c), repoFullName))
.toList
JsonFormat(commits)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ trait DashboardControllerBase extends ControllerBase {
get("/dashboard/issues")(usersOnly {
val q = request.getParameter("q")
val account = context.loginAccount.get
Option(q).map {
q =>
Option(q).map { q =>
val condition = IssueSearchCondition(q, Map[String, Int]())
q match {
case q if (q.contains("is:pr")) =>
Expand Down Expand Up @@ -63,8 +62,7 @@ trait DashboardControllerBase extends ControllerBase {
get("/dashboard/pulls")(usersOnly {
val q = request.getParameter("q")
val account = context.loginAccount.get
Option(q).map {
q =>
Option(q).map { q =>
val condition = IssueSearchCondition(q, Map[String, Int]())
q match {
case q if (q.contains("is:issue")) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ trait IssuesControllerBase extends ControllerBase {
// record activity
recordCreateIssueActivity(owner, name, userName, issueId, form.title)

getIssue(owner, name, issueId.toString).foreach {
issue =>
getIssue(owner, name, issueId.toString).foreach { issue =>
// extract references and create refer comment
createReferComment(
owner,
Expand All @@ -173,8 +172,7 @@ trait IssuesControllerBase extends ControllerBase {
context.loginAccount.get)

// notifications
Notifier()
.toNotify(repository, issue, form.content.getOrElse("")) {
Notifier().toNotify(repository, issue, form.content.getOrElse("")) {
Notifier.msgIssue(
s"${context.baseUrl}/${owner}/${name}/issues/${issueId}")
}
Expand All @@ -188,8 +186,7 @@ trait IssuesControllerBase extends ControllerBase {
readableUsersOnly { (title, repository) =>
defining(repository.owner, repository.name) {
case (owner, name) =>
getIssue(owner, name, params("id")).map {
issue =>
getIssue(owner, name, params("id")).map { issue =>
if (isEditable(owner, name, issue.openedUserName)) {
// update issue
updateIssue(owner, name, issue.issueId, title, issue.content)
Expand All @@ -211,8 +208,7 @@ trait IssuesControllerBase extends ControllerBase {
readableUsersOnly { (content, repository) =>
defining(repository.owner, repository.name) {
case (owner, name) =>
getIssue(owner, name, params("id")).map {
issue =>
getIssue(owner, name, params("id")).map { issue =>
if (isEditable(owner, name, issue.openedUserName)) {
// update issue
updateIssue(owner, name, issue.issueId, issue.title, content)
Expand Down Expand Up @@ -417,8 +413,7 @@ trait IssuesControllerBase extends ControllerBase {
repository.name,
params("id").toInt,
milestoneId("milestoneId"))
milestoneId("milestoneId").map {
milestoneId =>
milestoneId("milestoneId").map { milestoneId =>
getMilestonesWithIssueCount(repository.owner, repository.name)
.find(_._1.milestoneId == milestoneId)
.map {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,15 @@ trait MilestonesControllerBase extends ControllerBase {
post(
"/:owner/:repository/issues/milestones/:milestoneId/edit",
milestoneForm)(collaboratorsOnly { (form, repository) =>
params("milestoneId").toIntOpt.flatMap {
milestoneId =>
params("milestoneId").toIntOpt.flatMap { milestoneId =>
getMilestone(repository.owner, repository.name, milestoneId).map {
milestone =>
updateMilestone(
milestone.copy(
title = form.title,
description = form.description,
dueDate = form.dueDate))
redirect(
s"/${repository.owner}/${repository.name}/issues/milestones")
redirect(s"/${repository.owner}/${repository.name}/issues/milestones")
}
} getOrElse NotFound
})
Expand Down
Loading

0 comments on commit cbfbeb8

Please sign in to comment.