From 5b1a3c3c7b47b5b0a37e93c6fd24c062b161db76 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 18 Nov 2023 08:16:48 +0000 Subject: [PATCH 1/3] Update scalafmt-core to 3.7.17 --- .scalafmt.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index e9fe898..370af77 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = 3.7.3 +version = 3.7.17 runner.dialect = scala213 From 1615a40d7b11a85cee7a56cf6406d34c05f29571 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 18 Nov 2023 08:17:01 +0000 Subject: [PATCH 2/3] Reformat with scalafmt 3.7.17 Executed command: scalafmt --non-interactive --- .../scala/rozklad/api/MaintenanceService.scala | 1 - .../scala/rozklad/api/ScheduledTaskService.scala | 16 ++++++++-------- .../db/DoobieScheduledTaskRepository.scala | 2 +- .../scala/rozklad/db/DoobieTaskScheduler.scala | 3 ++- .../rozklad/db/ScheduledTaskLogRepository.scala | 2 +- .../rozklad/db/ScheduledTaskRepository.scala | 3 +-- .../db/DoobieScheduledTaskServiceTest.scala | 1 - .../impl/ExecutorServiceServiceTest.scala | 15 +++++---------- 8 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/main/scala/rozklad/api/MaintenanceService.scala b/src/main/scala/rozklad/api/MaintenanceService.scala index 299fcb7..a42e34f 100644 --- a/src/main/scala/rozklad/api/MaintenanceService.scala +++ b/src/main/scala/rozklad/api/MaintenanceService.scala @@ -1,6 +1,5 @@ package rozklad.api - trait MaintenanceService[F[_]] { def remove(id: Id[ScheduledTask]): F[RemovedScheduledTask] diff --git a/src/main/scala/rozklad/api/ScheduledTaskService.scala b/src/main/scala/rozklad/api/ScheduledTaskService.scala index 839335a..19b3e29 100644 --- a/src/main/scala/rozklad/api/ScheduledTaskService.scala +++ b/src/main/scala/rozklad/api/ScheduledTaskService.scala @@ -22,13 +22,13 @@ trait ScheduledTaskService[F[_]] { case class TaskIsNotInExpectedStatusException(id: Id[ScheduledTask]) extends RuntimeException(s"Task ${id} is not in acquired state") case class ScheduledTaskLog( - id: Id[ScheduledTaskLog], - taskId: Id[ScheduledTask], - status: Status, - createdAt: Instant, - failedReason: Option[FailedReason], - payload: JsValue, - triggerAt: Option[Instant]) + id: Id[ScheduledTaskLog], + taskId: Id[ScheduledTask], + status: Status, + createdAt: Instant, + failedReason: Option[FailedReason], + payload: JsValue, + triggerAt: Option[Instant]) object ScheduledTaskLog { def from(task: ScheduledTask): ScheduledTaskLog = { @@ -43,4 +43,4 @@ object ScheduledTaskLog { Some(triggerAt) ) } -} \ No newline at end of file +} diff --git a/src/main/scala/rozklad/db/DoobieScheduledTaskRepository.scala b/src/main/scala/rozklad/db/DoobieScheduledTaskRepository.scala index 5182049..b8b3a79 100644 --- a/src/main/scala/rozklad/db/DoobieScheduledTaskRepository.scala +++ b/src/main/scala/rozklad/db/DoobieScheduledTaskRepository.scala @@ -152,4 +152,4 @@ class DoobieScheduledTaskRepository(table: String) extends ScheduledTaskReposito query.query[ScheduledTask].to[List] } -} \ No newline at end of file +} diff --git a/src/main/scala/rozklad/db/DoobieTaskScheduler.scala b/src/main/scala/rozklad/db/DoobieTaskScheduler.scala index 3976faf..15873af 100644 --- a/src/main/scala/rozklad/db/DoobieTaskScheduler.scala +++ b/src/main/scala/rozklad/db/DoobieTaskScheduler.scala @@ -18,7 +18,8 @@ class DoobieTaskScheduler[F[_]]( xa: Transactor[F], observer: Observer[F], scheduledTaskRepository: ScheduledTaskRepository = new DoobieScheduledTaskRepository(DefaultScheduledTasksTableName), - scheduledTaskLogsRepository: ScheduledTaskLogRepository = new DoobieScheduledTaskLogRepository(DefaultScheduledTasksLogsTableName))(implicit ME: MonadCancel[F, Throwable]) + scheduledTaskLogsRepository: ScheduledTaskLogRepository = new DoobieScheduledTaskLogRepository(DefaultScheduledTasksLogsTableName))( + implicit ME: MonadCancel[F, Throwable]) extends TaskScheduler[F] { override def schedule(id: Id[ScheduledTask], triggerAt: Instant, scheduledAt: Instant, payload: JsValue): F[ScheduledTask] = { diff --git a/src/main/scala/rozklad/db/ScheduledTaskLogRepository.scala b/src/main/scala/rozklad/db/ScheduledTaskLogRepository.scala index 81fb253..dc8ba52 100644 --- a/src/main/scala/rozklad/db/ScheduledTaskLogRepository.scala +++ b/src/main/scala/rozklad/db/ScheduledTaskLogRepository.scala @@ -6,4 +6,4 @@ trait ScheduledTaskLogRepository { def insert(tasks: List[ScheduledTask]): doobie.ConnectionIO[Unit] def select(id: Id[ScheduledTask]): doobie.ConnectionIO[List[ScheduledTaskLog]] def delete(id: Id[ScheduledTask]): doobie.ConnectionIO[List[ScheduledTaskLog]] -} \ No newline at end of file +} diff --git a/src/main/scala/rozklad/db/ScheduledTaskRepository.scala b/src/main/scala/rozklad/db/ScheduledTaskRepository.scala index e5d6a71..beae614 100644 --- a/src/main/scala/rozklad/db/ScheduledTaskRepository.scala +++ b/src/main/scala/rozklad/db/ScheduledTaskRepository.scala @@ -21,5 +21,4 @@ trait ScheduledTaskRepository { updatedPayload: Option[JsValue]): doobie.ConnectionIO[List[ScheduledTask]] } - -case class InsertDuplicate() extends RuntimeException \ No newline at end of file +case class InsertDuplicate() extends RuntimeException diff --git a/src/test/scala/rozklad/db/DoobieScheduledTaskServiceTest.scala b/src/test/scala/rozklad/db/DoobieScheduledTaskServiceTest.scala index 32dc158..6242fdc 100644 --- a/src/test/scala/rozklad/db/DoobieScheduledTaskServiceTest.scala +++ b/src/test/scala/rozklad/db/DoobieScheduledTaskServiceTest.scala @@ -79,7 +79,6 @@ class DoobieScheduledTaskServiceTest extends AnyFlatSpec with EmbeddedPosrtesqlD assert(observer.last == TaskRescheduled(rescheduled)) } - it should "acquire rescheduled task" in new ctx { givenRescheduledAcquiredTask() } diff --git a/src/test/scala/rozklad/impl/ExecutorServiceServiceTest.scala b/src/test/scala/rozklad/impl/ExecutorServiceServiceTest.scala index 56b3191..46d8831 100644 --- a/src/test/scala/rozklad/impl/ExecutorServiceServiceTest.scala +++ b/src/test/scala/rozklad/impl/ExecutorServiceServiceTest.scala @@ -20,8 +20,7 @@ import scala.reflect.ClassTag class ExecutorServiceServiceTest extends AnyFlatSpec with ScheduledTaskLogMatchers with MockFactory { "ExecutorService" should "report failing" in new ctx { - self => - val e = new RuntimeException("test") + self => val e = new RuntimeException("test") (tasks.acquireBatch _).expects(*, *).returning(IO.raiseError(e)).once() val es = createExecutor eventually { @@ -49,8 +48,7 @@ class ExecutorServiceServiceTest extends AnyFlatSpec with ScheduledTaskLogMatche } it should "report successful execution" in new ctx { - s => - (tasks.acquireBatch _).expects(*, *).returning(IO(List(task))) + s => (tasks.acquireBatch _).expects(*, *).returning(IO(List(task))) (executor.execute _).expects(*).returning(IO(ScheduledTaskOutcome.Succeeded.empty)) (tasks.succeeded _).expects(*, *, *).returning(IO(task)) @@ -65,8 +63,7 @@ class ExecutorServiceServiceTest extends AnyFlatSpec with ScheduledTaskLogMatche } it should "report failed execution" in new ctx { - self => - (tasks.acquireBatch _).expects(*, *).returning(IO(List(task))) + self => (tasks.acquireBatch _).expects(*, *).returning(IO(List(task))) val reason: FailedReason.Exception.type = FailedReason.Exception val payload: JsObject = Json.obj("Hui" -> "no") (executor.execute _).expects(*).returning(IO(ScheduledTaskOutcome.Failed(Option(reason), Some(payload)))) @@ -85,8 +82,7 @@ class ExecutorServiceServiceTest extends AnyFlatSpec with ScheduledTaskLogMatche } it should "report errored execution" in new ctx { - self => - (tasks.acquireBatch _).expects(*, *).returning(IO(List(task))) + self => (tasks.acquireBatch _).expects(*, *).returning(IO(List(task))) (tasks.failed _).expects(*, *, *, *).returning(IO(task)) val e = new RuntimeException("error") (executor.execute _).expects(*).returning(IO.raiseError(e)) @@ -114,8 +110,7 @@ class ExecutorServiceServiceTest extends AnyFlatSpec with ScheduledTaskLogMatche } it should "propagate error during handling execution result" in new ctx { - s => - val ex = new RuntimeException("dsfsdf") + s => val ex = new RuntimeException("dsfsdf") (tasks.acquireBatch _).expects(*, *).returning(IO(List(task))) (executor.execute _).expects(*).returning(IO(ScheduledTaskOutcome.Succeeded.empty)) From f5c30ac2d000a41d42c3a2373134e5ce81a6dd50 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 18 Nov 2023 08:17:01 +0000 Subject: [PATCH 3/3] Add 'Reformat with scalafmt 3.7.17' to .git-blame-ignore-revs --- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 7a2b398..606fb5f 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -6,3 +6,6 @@ # Scala Steward: Reformat with scalafmt 3.7.2 94ac503f44955f8170daee4d2ca2e7f54411ad74 + +# Scala Steward: Reformat with scalafmt 3.7.17 +1615a40d7b11a85cee7a56cf6406d34c05f29571