From 8e86238967a575272433ba66cb447fcdd0295f35 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 19 Jan 2025 17:50:04 +0000 Subject: [PATCH 1/3] Update scalafmt-core to 3.8.5 --- .scalafmt.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index bf6870c8..5c98a00a 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = 3.8.3 +version = 3.8.5 runner.dialect = Scala213Source3 maxColumn = 100 indent.defnSite = 2 From 893da8af99210d857f138f93529f6380a7293816 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 19 Jan 2025 17:50:36 +0000 Subject: [PATCH 2/3] Reformat with scalafmt 3.8.5 Executed command: scalafmt --non-interactive --- .../com/advancedtelematic/tuf/cli/Cli.scala | 5 +- .../keyserver/http/RootRoleResourceSpec.scala | 5 +- .../delegations/RemoteDelegationClient.scala | 5 +- .../tuf/reposerver/http/PackageSearch.scala | 2 +- .../tuf/reposerver/http/RepoResource.scala | 9 +-- .../http/RepoResourceDelegationsSpec.scala | 5 +- .../http/RepoTargetsResourceSpec.scala | 59 +++++++++++-------- 7 files changed, 48 insertions(+), 42 deletions(-) diff --git a/cli/src/main/scala/com/advancedtelematic/tuf/cli/Cli.scala b/cli/src/main/scala/com/advancedtelematic/tuf/cli/Cli.scala index 5264f951..fb2af06b 100644 --- a/cli/src/main/scala/com/advancedtelematic/tuf/cli/Cli.scala +++ b/cli/src/main/scala/com/advancedtelematic/tuf/cli/Cli.scala @@ -215,9 +215,8 @@ object Cli extends App with VersionInfo { "The directory that you want to work with. By default, it is your current working directory." ) - opt[Unit]("verbose").text("Prints the verbose information for the execution.").action { - (_, c) => - c.copy(verbose = true) + opt[Unit]("verbose").text("Prints the verbose information for the execution.").action { (_, c) => + c.copy(verbose = true) } version("version").text("Prints the current binary version.") diff --git a/keyserver/src/test/scala/com/advancedtelematic/tuf/keyserver/http/RootRoleResourceSpec.scala b/keyserver/src/test/scala/com/advancedtelematic/tuf/keyserver/http/RootRoleResourceSpec.scala index 266b7f45..6ae75574 100644 --- a/keyserver/src/test/scala/com/advancedtelematic/tuf/keyserver/http/RootRoleResourceSpec.scala +++ b/keyserver/src/test/scala/com/advancedtelematic/tuf/keyserver/http/RootRoleResourceSpec.scala @@ -185,10 +185,7 @@ class RootRoleResourceSpec .futureValue .map(_.status) should contain only KeyGenRequestStatus.ERROR - Put( - apiUri(s"root/${repoId.show}"), - ClientRootGenRequest(keyType = keyType) - ) ~> routes ~> check { + Put(apiUri(s"root/${repoId.show}"), ClientRootGenRequest(keyType = keyType)) ~> routes ~> check { status shouldBe StatusCodes.OK } diff --git a/reposerver/src/main/scala/com/advancedtelematic/tuf/reposerver/delegations/RemoteDelegationClient.scala b/reposerver/src/main/scala/com/advancedtelematic/tuf/reposerver/delegations/RemoteDelegationClient.scala index 20cf79d1..85cae50b 100644 --- a/reposerver/src/main/scala/com/advancedtelematic/tuf/reposerver/delegations/RemoteDelegationClient.scala +++ b/reposerver/src/main/scala/com/advancedtelematic/tuf/reposerver/delegations/RemoteDelegationClient.scala @@ -55,9 +55,8 @@ class HttpRemoteDelegationClient()(implicit val ec: ExecutionContext, system: Ac um.apply(entity) .recoverWith { case err => if (log.isDebugEnabled) { - unmarshallStringOrError(entity).recover { case err => err.getMessage }.foreach { - payload => - log.warn("Could not unmarshall remote response. Response was: " + payload) + unmarshallStringOrError(entity).recover { case err => err.getMessage }.foreach { payload => + log.warn("Could not unmarshall remote response. Response was: " + payload) } } diff --git a/reposerver/src/main/scala/com/advancedtelematic/tuf/reposerver/http/PackageSearch.scala b/reposerver/src/main/scala/com/advancedtelematic/tuf/reposerver/http/PackageSearch.scala index 75dc5c87..e8d6de4a 100644 --- a/reposerver/src/main/scala/com/advancedtelematic/tuf/reposerver/http/PackageSearch.scala +++ b/reposerver/src/main/scala/com/advancedtelematic/tuf/reposerver/http/PackageSearch.scala @@ -260,7 +260,7 @@ class PackageSearch()(implicit db: Database) { } - def hardwareIdsWithPackages(repoId: RepoId): Future[Seq[HardwareIdentifier]] = { + def hardwareIdsWithPackages(repoId: RepoId): Future[Seq[HardwareIdentifier]] = { implicit val getResult: GetResult[HardwareIdentifier] = GetResult.GetString.andThen { str => refineV[ValidHardwareIdentifier](str) .valueOr(msg => diff --git a/reposerver/src/main/scala/com/advancedtelematic/tuf/reposerver/http/RepoResource.scala b/reposerver/src/main/scala/com/advancedtelematic/tuf/reposerver/http/RepoResource.scala index 4745ab69..fe988731 100644 --- a/reposerver/src/main/scala/com/advancedtelematic/tuf/reposerver/http/RepoResource.scala +++ b/reposerver/src/main/scala/com/advancedtelematic/tuf/reposerver/http/RepoResource.scala @@ -476,9 +476,7 @@ class RepoResource(keyserverClient: KeyserverClient, } ~ (patch & path(DelegatedRoleNamePath / "info") & entity(as[DelegationInfo])) { (delegatedRoleName, delegationInfo) => - onSuccess( - delegations.setDelegationInfo(repoId, delegatedRoleName, delegationInfo) - ) { + onSuccess(delegations.setDelegationInfo(repoId, delegatedRoleName, delegationInfo)) { complete(StatusCodes.OK) } } ~ @@ -671,7 +669,10 @@ class RepoResource(keyserverClient: KeyserverClient, complete(editTargetItem(namespace, repoId, filename, item)) } } ~ - withRequestTimeout(userRepoUploadRequestTimeout, timeoutResponseHandler) { // For when SignedPayload[TargetsRole] is too big and takes a long time to upload + withRequestTimeout( + userRepoUploadRequestTimeout, + timeoutResponseHandler + ) { // For when SignedPayload[TargetsRole] is too big and takes a long time to upload decodeRequest { (pathEnd & put & entity(as[SignedPayload[TargetsRole]])) { signedPayload => extractRoleChecksumHeader { checksum => diff --git a/reposerver/src/test/scala/com/advancedtelematic/tuf/reposerver/http/RepoResourceDelegationsSpec.scala b/reposerver/src/test/scala/com/advancedtelematic/tuf/reposerver/http/RepoResourceDelegationsSpec.scala index 25599d5a..939d2aca 100644 --- a/reposerver/src/test/scala/com/advancedtelematic/tuf/reposerver/http/RepoResourceDelegationsSpec.scala +++ b/reposerver/src/test/scala/com/advancedtelematic/tuf/reposerver/http/RepoResourceDelegationsSpec.scala @@ -73,10 +73,7 @@ class RepoResourceDelegationsSpec } private def addNewTrustedDelegationKeysOK(tufKeys: TufKey*)(implicit repoId: RepoId): Unit = - Put( - apiUri(s"repo/${repoId.show}/trusted-delegations/keys"), - tufKeys.asJson - ) ~> routes ~> check { + Put(apiUri(s"repo/${repoId.show}/trusted-delegations/keys"), tufKeys.asJson) ~> routes ~> check { status shouldBe StatusCodes.NoContent } diff --git a/reposerver/src/test/scala/com/advancedtelematic/tuf/reposerver/http/RepoTargetsResourceSpec.scala b/reposerver/src/test/scala/com/advancedtelematic/tuf/reposerver/http/RepoTargetsResourceSpec.scala index cd3c1a59..1058d051 100644 --- a/reposerver/src/test/scala/com/advancedtelematic/tuf/reposerver/http/RepoTargetsResourceSpec.scala +++ b/reposerver/src/test/scala/com/advancedtelematic/tuf/reposerver/http/RepoTargetsResourceSpec.scala @@ -8,7 +8,11 @@ import org.scalatest.OptionValues.* import akka.http.scaladsl.model.{HttpEntity, StatusCodes} import akka.util.ByteString import com.advancedtelematic.libats.data.PaginationResult -import com.advancedtelematic.tuf.reposerver.util.{RepoResourceDelegationsSpecUtil, ResourceSpec, TufReposerverSpec} +import com.advancedtelematic.tuf.reposerver.util.{ + RepoResourceDelegationsSpecUtil, + ResourceSpec, + TufReposerverSpec +} import com.advancedtelematic.tuf.reposerver.util.NamespaceSpecOps.* import de.heikoseeberger.akkahttpcirce.FailFastCirceSupport.* import com.advancedtelematic.tuf.reposerver.data.RepoDataType.* @@ -593,31 +597,40 @@ class RepoTargetsResourceSpec } } - testWithRepo("GET hardwareids-packages returns hwids for which there are packages") { implicit ns => implicit repoId => - addTargetToRepo(repoId) + testWithRepo("GET hardwareids-packages returns hwids for which there are packages") { + implicit ns => implicit repoId => + addTargetToRepo(repoId) - Put( - apiUri("user_repo/targets/mypkg_file?name=library&version=0.0.1&hardwareIds=myid001,myid002"), - testEntity - ).namespaced ~> routes ~> check { - status shouldBe StatusCodes.NoContent - } + Put( + apiUri( + "user_repo/targets/mypkg_file?name=library&version=0.0.1&hardwareIds=myid001,myid002" + ), + testEntity + ).namespaced ~> routes ~> check { + status shouldBe StatusCodes.NoContent + } - Put( - apiUri("user_repo/targets/mypkg_file2?name=library&version=0.0.2&hardwareIds=myid002,myid003"), - testEntity2 - ).namespaced ~> routes ~> check { - status shouldBe StatusCodes.NoContent - } + Put( + apiUri( + "user_repo/targets/mypkg_file2?name=library&version=0.0.2&hardwareIds=myid002,myid003" + ), + testEntity2 + ).namespaced ~> routes ~> check { + status shouldBe StatusCodes.NoContent + } - Get(apiUriV2(s"user_repo/hardwareids-packages")).namespaced ~> routes ~> check { - status shouldBe StatusCodes.OK - val result = responseAs[PaginationResult[HardwareIdentifier]] - result.total shouldBe 3 - result.offset shouldBe 0 - result.limit shouldBe 3 - result.values.map(_.value) should contain theSameElementsAs List("myid001", "myid002", "myid003") - } + Get(apiUriV2(s"user_repo/hardwareids-packages")).namespaced ~> routes ~> check { + status shouldBe StatusCodes.OK + val result = responseAs[PaginationResult[HardwareIdentifier]] + result.total shouldBe 3 + result.offset shouldBe 0 + result.limit shouldBe 3 + result.values.map(_.value) should contain theSameElementsAs List( + "myid001", + "myid002", + "myid003" + ) + } } } From 1ffd3bced3d94e9f3fd49a8f009c78590727ef04 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 19 Jan 2025 17:50:36 +0000 Subject: [PATCH 3/3] Add 'Reformat with scalafmt 3.8.5' 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 4031b994..6b089b02 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -6,3 +6,6 @@ # Scala Steward: Reformat with scalafmt 3.8.3 1b46d1df04b53c9969027c1b4da33c0d47d11bd6 + +# Scala Steward: Reformat with scalafmt 3.8.5 +893da8af99210d857f138f93529f6380a7293816