Skip to content

Commit

Permalink
Scalafmt all the things
Browse files Browse the repository at this point in the history
  • Loading branch information
davesmith00000 committed Aug 24, 2024
1 parent 83c76f0 commit 3945377
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 26 deletions.
2 changes: 1 addition & 1 deletion examples/main-launcher/src/main/scala/example/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ object Main {
def main(args: Array[String]): Unit =
TyrianIOApp.onLoad(
"CounterApp" -> CounterApp,
"ChatApp" -> ChatApp
"ChatApp" -> ChatApp
)
}
10 changes: 4 additions & 6 deletions examples/mario/src/main/scala/Effects.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,13 @@ object Effects:
}

def keyPressSub(keyCode: Int): Sub[IO, KeyboardEvent] =
Sub.fromEvent[IO, KeyboardEvent, KeyboardEvent]("keydown", dom.window) {
event =>
if event.keyCode == keyCode then Some(event) else None
Sub.fromEvent[IO, KeyboardEvent, KeyboardEvent]("keydown", dom.window) { event =>
if event.keyCode == keyCode then Some(event) else None
}

def keyReleaseSub(keyCode: Int): Sub[IO, KeyboardEvent] =
Sub.fromEvent[IO, KeyboardEvent, KeyboardEvent]("keyup", dom.window) {
event =>
if event.keyCode == keyCode then Some(event) else None
Sub.fromEvent[IO, KeyboardEvent, KeyboardEvent]("keyup", dom.window) { event =>
if event.keyCode == keyCode then Some(event) else None
}

val UNDER_FRONT_MARIO = (true, true)
Expand Down
5 changes: 2 additions & 3 deletions examples/mario/src/main/scala/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ final case class Mario(
dir: Direction
)
object Mario:
val gravity = 0.25
val applyGravity: Mario => Mario = mario =>
mario.copy(vy = if (mario.y > 0) mario.vy - gravity else 0)
val gravity = 0.25
val applyGravity: Mario => Mario = mario => mario.copy(vy = if (mario.y > 0) mario.vy - gravity else 0)
val applyMotion: Mario => Mario = mario =>
mario.copy(
x = mario.x + mario.vx,
Expand Down
4 changes: 2 additions & 2 deletions examples/project/TyrianVersion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ object TyrianVersion {
def rec(path: String, levels: Int, version: Option[String]): String = {
val msg = "ERROR: Couldn't find Tyrian version."
version match {
case Some(v) =>
case Some(v) =>
println(s"""Tyrian version set to '$v'""")
v

Expand All @@ -21,7 +21,7 @@ object TyrianVersion {
throw new Exception(msg)
}
}

rec(".tyrian-version", 0, None)
}
}
4 changes: 2 additions & 2 deletions examples/server-examples/project/TyrianVersion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ object TyrianVersion {
def rec(path: String, levels: Int, version: Option[String]): String = {
val msg = "ERROR: Couldn't find Tyrian version."
version match {
case Some(v) =>
case Some(v) =>
println(s"""Tyrian version set to '$v'""")
v

Expand All @@ -21,7 +21,7 @@ object TyrianVersion {
throw new Exception(msg)
}
}

rec(".tyrian-version", 0, None)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ object ExampleServer:
for {
client <- Stream.resource(EmberClientBuilder.default[F].build)

httpApp = (Routes.routes[F](SSR.impl[F])).orNotFound
httpApp = Routes.routes[F](SSR.impl[F]).orNotFound

finalHttpApp = Logger.httpApp(true, true)(httpApp)

Expand Down
2 changes: 1 addition & 1 deletion examples/tailwind/src/main/scala/example/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ object Main extends TyrianIOApp[Msg, Model]:
)(span(cls := "text-gray-900 dark:text-white")("-")),
input(
cls := "bg-gray-50 border-x-0 border-gray-300 h-11 text-center text-gray-900 text-sm focus:ring-blue-500 focus:border-blue-500 block w-full py-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",
value := model.toString,
value := model.toString
),
button(
cls := "bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 dark:border-gray-600 hover:bg-gray-200 border border-gray-300 rounded-e-lg p-3 h-11 focus:ring-gray-100 dark:focus:ring-gray-700 focus:ring-2 focus:outline-none",
Expand Down
7 changes: 3 additions & 4 deletions examples/websocket/src/main/scala/example/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,13 @@ object Model:
val init: Model =
Model(EchoSocket.init, Nil)

/** Encapsulates and manages our socket connection, cleanly proxies methods, and
* knows how to draw the right connnect/disconnect button.
/** Encapsulates and manages our socket connection, cleanly proxies methods, and knows how to draw the right
* connnect/disconnect button.
*/
final case class EchoSocket(socketUrl: String, socket: Option[WebSocket[IO]]):

def connectDisconnectButton =
if socket.isDefined then
button(onClick(EchoSocket.Status.Disconnecting.asMsg))("Disconnect")
if socket.isDefined then button(onClick(EchoSocket.Status.Disconnecting.asMsg))("Disconnect")
else button(onClick(EchoSocket.Status.Connecting.asMsg))("Connect")

def update(status: EchoSocket.Status): (EchoSocket, Cmd[IO, Msg]) =
Expand Down
6 changes: 3 additions & 3 deletions project/CSSGen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ object CSSGen {

def genCssProp(name: String): String = {
val cssProp = s""" def `$name`(value: String): Style = Style("$name", value)"""
if (!name.contains("-") || name.contains("@")) {
if (!name.contains("-") || name.contains("@")) {
cssProp
} else {
val nameCC: String = name.split("-").toList match {
case Nil =>
throw new Exception(s"CSS property '$name' was unexpectedly empty")
throw new Exception(s"CSS property '$name' was unexpectedly empty")
case head :: tail =>
(head :: tail.map(_.capitalize)).mkString
(head :: tail.map(_.capitalize)).mkString
}
s"""$cssProp
| def ${nameCC}(value: String): Style = Style("$name", value)
Expand Down
4 changes: 2 additions & 2 deletions project/TyrianVersion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ object TyrianVersion {
def rec(path: String, levels: Int, version: Option[String]): String = {
val msg = "ERROR: Couldn't find Tyrian version."
version match {
case Some(v) =>
case Some(v) =>
println(s"""Tyrian version set to '$v'""")
v

Expand All @@ -21,7 +21,7 @@ object TyrianVersion {
throw new Exception(msg)
}
}

rec(".tyrian-version", 0, None)
}
}
2 changes: 1 addition & 1 deletion project/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4")

0 comments on commit 3945377

Please sign in to comment.