Skip to content

Commit

Permalink
Merge pull request #763 from scala-steward/update/scalafmt-core-3.8.2
Browse files Browse the repository at this point in the history
Update scalafmt-core to 3.8.2
  • Loading branch information
mergify[bot] authored Jun 25, 2024
2 parents e130389 + f41d1f2 commit 96c79da
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 75 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# initial scalafmt
0cd7f5aaffad9b813955d73cf0afee2be445782e

# Scala Steward: Reformat with scalafmt 3.8.2
1f7736d5edc8cf5fa9e680e0d3bfb017f4f04b9d
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.7.17
version = 3.8.2
runner.dialect = Scala213Source3
maxColumn = 100
indent.defnSite = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,10 @@ object Schema {
def uniqueRepoIdRoleTypeIdx =
index("key_gen_requests_unique_idx", (repoId, roleType), unique = true)

override def * = (
id,
repoId,
status,
roleType,
keySize,
keyType,
threshold,
description
) <> ((KeyGenRequest.apply _).tupled, KeyGenRequest.unapply)
override def * = (id, repoId, status, roleType, keySize, keyType, threshold, description) <> (
(KeyGenRequest.apply _).tupled,
KeyGenRequest.unapply
)

}

Expand All @@ -66,14 +60,10 @@ object Schema {
def publicKey = column[TufKey]("public_key")
def privateKey = column[EncryptedColumn[TufPrivateKey]]("private_key")

override def * = (
id,
repoId,
roleType,
keyType,
publicKey,
privateKey.decrypted
) <> ((Key.apply _).tupled, Key.unapply)
override def * = (id, repoId, roleType, keyType, publicKey, privateKey.decrypted) <> (
(Key.apply _).tupled,
Key.unapply
)

}

Expand All @@ -88,15 +78,15 @@ object Schema {
def pk = primaryKey("pk_signed_root_roles", (repoId, version))

private def content_parsed = content <>
({ c => SignedPayload(c.signatures, c.signed.as[RootRole].valueOr(throw _), c.signed) },
(x: SignedPayload[RootRole]) => Some(JsonSignedPayload(x.signatures, x.json)))

override def * = (
repoId,
content_parsed,
expiresAt,
version
) <> ((SignedRootRole.apply _).tupled, SignedRootRole.unapply)
(
{ c => SignedPayload(c.signatures, c.signed.as[RootRole].valueOr(throw _), c.signed) },
(x: SignedPayload[RootRole]) => Some(JsonSignedPayload(x.signatures, x.json))
)

override def * = (repoId, content_parsed, expiresAt, version) <> (
(SignedRootRole.apply _).tupled,
SignedRootRole.unapply
)

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import com.advancedtelematic.libtuf.crypt.CanonicalJson.*
import com.advancedtelematic.libtuf.data.ClientDataType.DelegatedRoleName
import com.advancedtelematic.libtuf.data.TufCodecs
import com.advancedtelematic.libtuf.data.TufDataType.TargetFormat.TargetFormat
import com.advancedtelematic.libtuf.data.TufDataType.{JsonSignedPayload, RoleType, TargetFormat, ValidKeyId}
import com.advancedtelematic.libtuf.data.TufDataType.{
JsonSignedPayload,
RoleType,
TargetFormat,
ValidKeyId
}
import com.advancedtelematic.libtuf_server.repo.server.Errors

import scala.util.Try
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package com.advancedtelematic.tuf.reposerver.data

import com.advancedtelematic.tuf.reposerver.data.RepoDataType.{AddDelegationFromRemoteRequest, AggregatedPackage, DelegationInfo, Package}
import com.advancedtelematic.tuf.reposerver.data.RepoDataType.{
AddDelegationFromRemoteRequest,
AggregatedPackage,
DelegationInfo,
Package
}
import com.advancedtelematic.libtuf.data.ClientCodecs.*
import com.advancedtelematic.libats.codecs.CirceRefined.*
import com.advancedtelematic.libats.http.HttpCodecs.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,6 @@ protected[db] class DelegationRepository()(implicit db: Database, ec: ExecutionC
Schema.delegations.filter(_.repoId === repoId).result
}


def persistAll(repoId: RepoId,
roleName: DelegatedRoleName,
content: JsonSignedPayload,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,10 @@ object Schema {

def pk = primaryKey("delegated_items_pk", (repoId, roleName, filename))

override def * = (
repoId,
filename,
roleName,
checksum,
length,
custom
) <> ((DelegatedTargetItem.apply _).tupled, DelegatedTargetItem.unapply)
override def * = (repoId, filename, roleName, checksum, length, custom) <> (
(DelegatedTargetItem.apply _).tupled,
DelegatedTargetItem.unapply
)

}

Expand All @@ -65,15 +61,10 @@ object Schema {

def pk = primaryKey("target_items_pk", (repoId, filename))

override def * = (
repoId,
filename,
uri,
checksum,
length,
custom,
storageMethod
) <> ((TargetItem.apply _).tupled, TargetItem.unapply)
override def * = (repoId, filename, uri, checksum, length, custom, storageMethod) <> (
(TargetItem.apply _).tupled,
TargetItem.unapply
)

}

Expand All @@ -90,15 +81,10 @@ object Schema {

def pk = primaryKey("signed_role_pk", (repoId, roleType))

override def * = (
repoId,
roleType,
content,
checksum,
length,
version,
expiresAt
) <> ((DbSignedRole.apply _).tupled, DbSignedRole.unapply)
override def * = (repoId, roleType, content, checksum, length, version, expiresAt) <> (
(DbSignedRole.apply _).tupled,
DbSignedRole.unapply
)

}

Expand Down Expand Up @@ -153,15 +139,11 @@ object Schema {

def pk = primaryKey("delegations_pk", (repoId, roleName))

override def * = (
repoId,
roleName,
content,
remoteUri,
lastFetched,
remoteHeaders,
friendlyName
) <> ((DbDelegation.apply _).tupled, DbDelegation.unapply)
override def * =
(repoId, roleName, content, remoteUri, lastFetched, remoteHeaders, friendlyName) <> (
(DbDelegation.apply _).tupled,
DbDelegation.unapply
)

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,16 @@ class DelegationsManagement()(implicit val db: Database, val ec: ExecutionContex
validateDelegationMetadataSignatures(targetsRole, delegation, delegationMetadata)
.valueOr(err => throw Errors.PayloadSignatureInvalid(err))

val validatedDelegationsRole = validateDelegationTargetPaths(targetsRole, roleName, delegationMetadata)
.valueOr(err => throw Errors.InvalidDelegatedTarget(err))
val validatedDelegationsRole =
validateDelegationTargetPaths(targetsRole, roleName, delegationMetadata)
.valueOr(err => throw Errors.InvalidDelegatedTarget(err))

val items = validatedDelegationsRole.signed.targets.map { case (filename, clientTargetItem) =>

val checksums = clientTargetItem.hashes.map { case (method, hash) =>
Checksum(method, hash)
}

if(checksums.isEmpty)
if (checksums.isEmpty)
throw Errors.InvalidDelegatedTarget(NonEmptyList.of("targets checksum cannot be empty"))

DelegatedTargetItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import akka.http.scaladsl.server.{Directive, Directives}
import akka.http.scaladsl.unmarshalling.PredefinedFromStringUnmarshallers.CsvSeq
import com.advancedtelematic.libtuf.data.ClientDataType.TargetCustom
import com.advancedtelematic.libtuf.data.TufDataType.TargetFormat.TargetFormat
import com.advancedtelematic.libtuf.data.TufDataType.{HardwareIdentifier, TargetFormat, TargetName, TargetVersion}
import com.advancedtelematic.libtuf.data.TufDataType.{
HardwareIdentifier,
TargetFormat,
TargetName,
TargetVersion
}
import io.circe.*
import akka.http.scaladsl.unmarshalling.*
import akka.http.scaladsl.util.FastFuture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,5 @@ object NamespaceRepoId {

def apply(namespaceValidation: NamespaceValidation, findNsRepoFn: Namespace => Future[RepoId]) =
namespaceValidation.extractor.flatMap(ns => UserRepoId(ns, findNsRepoFn))

}
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,9 @@ class RepoTargetsResourceSpec
status shouldBe StatusCodes.NoContent
}

Get(apiUriV2(s"user_repo/search?sortBy=filename&sortDirection=asc")).namespaced ~> routes ~> check {
Get(
apiUriV2(s"user_repo/search?sortBy=filename&sortDirection=asc")
).namespaced ~> routes ~> check {
status shouldBe StatusCodes.OK

val result = responseAs[PaginationResult[Package]]
Expand All @@ -262,7 +264,9 @@ class RepoTargetsResourceSpec
result.values.map(_.filename.value) shouldBe Seq("mypath/mytargetName", "zotherpackage")
}

Get(apiUriV2(s"user_repo/search?sortBy=filename&sortDirection=desc")).namespaced ~> routes ~> check {
Get(
apiUriV2(s"user_repo/search?sortBy=filename&sortDirection=desc")
).namespaced ~> routes ~> check {
status shouldBe StatusCodes.OK

val result = responseAs[PaginationResult[Package]]
Expand Down Expand Up @@ -497,7 +501,9 @@ class RepoTargetsResourceSpec
status shouldBe StatusCodes.NoContent
}

Get(apiUriV2(s"user_repo/grouped-search?sortBy=name&sortDirection=asc")).namespaced ~> routes ~> check {
Get(
apiUriV2(s"user_repo/grouped-search?sortBy=name&sortDirection=asc")
).namespaced ~> routes ~> check {
status shouldBe StatusCodes.OK
val values = responseAs[PaginationResult[AggregatedPackage]].values
values should have size 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import akka.http.scaladsl.model.{HttpRequest, StatusCodes}
import akka.http.scaladsl.model.headers.RawHeader
import com.advancedtelematic.libats.data.DataType.Namespace
import com.advancedtelematic.libtuf.data.TufDataType.RepoId
import com.advancedtelematic.tuf.reposerver.util.NamespaceSpecOps.{NamespaceTag, Namespaced, withRandomNamepace}
import com.advancedtelematic.tuf.reposerver.util.NamespaceSpecOps.{
withRandomNamepace,
NamespaceTag,
Namespaced
}
import io.circe.Json
import org.scalactic.source.Position
import org.scalatest.Tag
Expand Down

0 comments on commit 96c79da

Please sign in to comment.