diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 2c67df4d..b875e2d0 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -10,4 +10,6 @@ 9cc3dd838b39afa97ddb76987d070f35f9bd36b8 # eikek: remove header from all sources -eefe534f36aceb8b9b73176d968fb9eaff2a71d7 \ No newline at end of file +eefe534f36aceb8b9b73176d968fb9eaff2a71d7 +# Scala Steward: Reformat with scalafmt 3.8.4 +d69f2b9ad270b60b31fb1be20913f7b3fde799f4 diff --git a/.scalafmt.conf b/.scalafmt.conf index 89de18f1..1fee2b08 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = "3.8.3" +version = "3.8.4" preset = default align.preset = some diff --git a/modules/events/src/test/scala/io/renku/events/EventsGenerators.scala b/modules/events/src/test/scala/io/renku/events/EventsGenerators.scala index 0a86247f..5785e1d6 100644 --- a/modules/events/src/test/scala/io/renku/events/EventsGenerators.scala +++ b/modules/events/src/test/scala/io/renku/events/EventsGenerators.scala @@ -65,9 +65,8 @@ object EventsGenerators: Gen.listOfN(1, plgen).flatMap { pl => val schema = pl.head.schema val mt = pl.head.msgType - eventMessageGen(schema, mt, Gen.const(pl)).map(msg => - msg.copy(header = msg.header.withSchemaVersion(pl.head.version.head)) - ) + eventMessageGen(schema, mt, Gen.const(pl)) + .map(msg => msg.copy(header = msg.header.withSchemaVersion(pl.head.version.head))) } def v1ProjectCreatedGen(prefix: String): Gen[v1.ProjectCreated] = diff --git a/modules/openid-keycloak/src/main/scala/io/renku/openid/keycloak/JwtVerify.scala b/modules/openid-keycloak/src/main/scala/io/renku/openid/keycloak/JwtVerify.scala index 5de94d50..43c26a66 100644 --- a/modules/openid-keycloak/src/main/scala/io/renku/openid/keycloak/JwtVerify.scala +++ b/modules/openid-keycloak/src/main/scala/io/renku/openid/keycloak/JwtVerify.scala @@ -19,6 +19,5 @@ object JwtVerify: def verify(token: String): F[Either[JwtError, RenkuToken]] = Applicative[F].pure(result match case a: JwtError => Left(a) - case b: RenkuToken => Right(b) - ) + case b: RenkuToken => Right(b)) } diff --git a/modules/search-api/src/main/scala/io/renku/search/api/auth/Authenticate.scala b/modules/search-api/src/main/scala/io/renku/search/api/auth/Authenticate.scala index 47cbac27..f786f158 100644 --- a/modules/search-api/src/main/scala/io/renku/search/api/auth/Authenticate.scala +++ b/modules/search-api/src/main/scala/io/renku/search/api/auth/Authenticate.scala @@ -21,7 +21,7 @@ object Authenticate: case AuthToken.AnonymousId(id) => Right(AuthContext.anonymousId(id.value)).pure[F] case AuthToken.JwtToken(token) => - EitherT(verify.verify(token).map(ClaimToContext.from)).leftSemiflatMap { - err => logger.warn(err.sanitized, err.cause).as(err.sanitized) + EitherT(verify.verify(token).map(ClaimToContext.from)).leftSemiflatMap { err => + logger.warn(err.sanitized, err.cause).as(err.sanitized) }.value } diff --git a/modules/search-cli/src/main/scala/io/renku/search/cli/perftests/PerfTestsConfig.scala b/modules/search-cli/src/main/scala/io/renku/search/cli/perftests/PerfTestsConfig.scala index b45a0be6..9b238ec5 100644 --- a/modules/search-cli/src/main/scala/io/renku/search/cli/perftests/PerfTestsConfig.scala +++ b/modules/search-cli/src/main/scala/io/renku/search/cli/perftests/PerfTestsConfig.scala @@ -67,7 +67,7 @@ private object RedisConfigOpts: private val refreshInterval: Opts[FiniteDuration] = Opts .option[FiniteDuration]("redis-connection-refresh", "Redis connection refresh") - .withDefault(1 hour) + .withDefault(1.hour) val configOpts: Opts[RedisConfig] = (host, port, sentinel, db.map(Option(_)), password, masterSet, refreshInterval) diff --git a/modules/search-provision/src/main/scala/io/renku/search/provision/handler/DocumentMerger.scala b/modules/search-provision/src/main/scala/io/renku/search/provision/handler/DocumentMerger.scala index 7b23d406..f9be895e 100644 --- a/modules/search-provision/src/main/scala/io/renku/search/provision/handler/DocumentMerger.scala +++ b/modules/search-provision/src/main/scala/io/renku/search/provision/handler/DocumentMerger.scala @@ -28,14 +28,13 @@ object DocumentMerger: } given DocumentMerger[ProjectMemberAdded] = - instance[ProjectMemberAdded](_.toModel(DocVersion.NotExists).some) { - (paa, existing) => - existing match - case p: PartialEntityDocument.Project => - p.modifyEntityMembers(_.addMember(paa.userId, paa.role)).some - case p: ProjectDocument => - p.modifyEntityMembers(_.addMember(paa.userId, paa.role)).some - case _: PartialEntityDocument.Group | _: GroupDocument | _: UserDocument => None + instance[ProjectMemberAdded](_.toModel(DocVersion.NotExists).some) { (paa, existing) => + existing match + case p: PartialEntityDocument.Project => + p.modifyEntityMembers(_.addMember(paa.userId, paa.role)).some + case p: ProjectDocument => + p.modifyEntityMembers(_.addMember(paa.userId, paa.role)).some + case _: PartialEntityDocument.Group | _: GroupDocument | _: UserDocument => None } given DocumentMerger[ProjectMemberUpdated] = @@ -127,15 +126,14 @@ object DocumentMerger: } given DocumentMerger[GroupMemberUpdated] = - instance[GroupMemberUpdated](_.toModel(DocVersion.NotExists).some) { - (gmu, existing) => - existing match - case g: PartialEntityDocument.Group => - g.modifyEntityMembers(_.addMember(gmu.userId, gmu.role)).some - case g: GroupDocument => - g.modifyEntityMembers(_.addMember(gmu.userId, gmu.role)).some - case _: PartialEntityDocument.Project | _: UserDocument | _: ProjectDocument => - None + instance[GroupMemberUpdated](_.toModel(DocVersion.NotExists).some) { (gmu, existing) => + existing match + case g: PartialEntityDocument.Group => + g.modifyEntityMembers(_.addMember(gmu.userId, gmu.role)).some + case g: GroupDocument => + g.modifyEntityMembers(_.addMember(gmu.userId, gmu.role)).some + case _: PartialEntityDocument.Project | _: UserDocument | _: ProjectDocument => + None } given DocumentMerger[GroupMemberRemoved] = diff --git a/modules/search-provision/src/main/scala/io/renku/search/provision/handler/FetchFromSolr.scala b/modules/search-provision/src/main/scala/io/renku/search/provision/handler/FetchFromSolr.scala index 28323401..1794e6ae 100644 --- a/modules/search-provision/src/main/scala/io/renku/search/provision/handler/FetchFromSolr.scala +++ b/modules/search-provision/src/main/scala/io/renku/search/provision/handler/FetchFromSolr.scala @@ -22,7 +22,9 @@ import io.renku.solr.client.{QueryData, QueryString} trait FetchFromSolr[F[_]]: def fetchEntityForUser(userId: Id): Stream[F, EntityId] def loadProjectsByGroup[A](msg: EntityOrPartialMessage[A]): F[EntityOrPartialMessage[A]] - def loadEntityOrPartial[A](using IdExtractor[A])( + def loadEntityOrPartial[A](using + IdExtractor[A] + )( msg: EventMessage[A] ): F[EntityOrPartialMessage[A]] def loadProjectGroups( @@ -89,7 +91,9 @@ object FetchFromSolr: QueryData(query).withFields(EntityDocumentSchema.Fields.id) ) - def loadEntityOrPartial[A](using IdExtractor[A])( + def loadEntityOrPartial[A](using + IdExtractor[A] + )( msg: EventMessage[A] ): F[EntityOrPartialMessage[A]] = val loaded = diff --git a/modules/solr-client/src/main/scala/io/renku/solr/client/QueryData.scala b/modules/solr-client/src/main/scala/io/renku/solr/client/QueryData.scala index 798b1c54..42cf06f9 100644 --- a/modules/solr-client/src/main/scala/io/renku/solr/client/QueryData.scala +++ b/modules/solr-client/src/main/scala/io/renku/solr/client/QueryData.scala @@ -31,7 +31,7 @@ final case class QueryData( def withCursor(cursorMark: CursorMark): QueryData = copy(params = params.updated("cursorMark", cursorMark.render)) - /** When using a cursor, it is required to add a `uniqueKey`field to the sort clause to + /** When using a cursor, it is required to add a `uniqueKey` field to the sort clause to * guarantee a deterministic order. */ def withCursor(cursorMark: CursorMark, keyField: FieldName): QueryData = diff --git a/project/AvroCodeGen.scala b/project/AvroCodeGen.scala index 3960b3cb..2056ef90 100644 --- a/project/AvroCodeGen.scala +++ b/project/AvroCodeGen.scala @@ -8,16 +8,14 @@ object AvroCodeGen extends AutoPlugin { def avroHuggerSettings = Seq( libraryDependencies ++= Dependencies.avro, - Compile / avroScalaCustomTypes := { + Compile / avroScalaCustomTypes := avrohugger.format.SpecificRecord.defaultTypes.copy( record = avrohugger.types.ScalaCaseClassWithSchema - ) - }, - Compile / avroScalaSpecificCustomTypes := { + ), + Compile / avroScalaSpecificCustomTypes := avrohugger.format.SpecificRecord.defaultTypes.copy( record = avrohugger.types.ScalaCaseClassWithSchema ) - } ) override def projectSettings = avroHuggerSettings ++ Seq( diff --git a/project/DbTestPlugin.scala b/project/DbTestPlugin.scala index 3ea9421d..b3cec532 100644 --- a/project/DbTestPlugin.scala +++ b/project/DbTestPlugin.scala @@ -16,7 +16,7 @@ object DbTestPlugin extends AutoPlugin { override def trigger = PluginTrigger.AllRequirements override def projectSettings: Seq[Def.Setting[_]] = Seq( - Test / dbTests := { + Test / dbTests := Def .sequential( Def.task { @@ -36,8 +36,7 @@ object DbTestPlugin extends AutoPlugin { RedisServer.forceStop() } ) - .value - }, + .value, // We need to disable running the `dbTests` on all aggregates, // otherwise it would try starting/stopping servers again and // again. The `all(ScopeFilter(inAggregates(ThisProject)))` makes