diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000..313667f1 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# Scala Steward: Reformat with scalafmt 3.8.5 +99571a2f4051a63e96aa41d960179f50ec9f7955 diff --git a/.scalafmt.conf b/.scalafmt.conf index 5781b828..0ac2a567 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = 3.8.3 +version = 3.8.5 runner.dialect = Scala213Source3 newlines.alwaysBeforeElseAfterCurlyIf = false diff --git a/core/src/main/scala/Streams.scala b/core/src/main/scala/Streams.scala index c1c0c7c2..647c12a6 100644 --- a/core/src/main/scala/Streams.scala +++ b/core/src/main/scala/Streams.scala @@ -124,7 +124,7 @@ private[benji] object Streams { def onPull(): Unit = { downstreamWaiting = true - if (/*outbuf.isEmpty && */ !hasBeenPulled(in)) pull(in) + if ( /*outbuf.isEmpty && */ !hasBeenPulled(in)) pull(in) } setHandlers(in, out, this) @@ -189,7 +189,7 @@ private[benji] object Streams { def onPull(): Unit = { downstreamWaiting = true - if (/*outbuf.isEmpty && */ !hasBeenPulled(in)) pull(in) + if ( /*outbuf.isEmpty && */ !hasBeenPulled(in)) pull(in) } setHandlers(in, out, this) diff --git a/core/src/test/scala/ErrorCommonSpec.scala b/core/src/test/scala/ErrorCommonSpec.scala index 47a30332..7319973e 100644 --- a/core/src/test/scala/ErrorCommonSpec.scala +++ b/core/src/test/scala/ErrorCommonSpec.scala @@ -79,8 +79,9 @@ trait ErrorCommonSpec extends BenjiMatchers { { nonExistingBucket must notExistsIn(storage, 0, 3.seconds) } and { - existingBucket.create(failsIfExists = true) must beTypedEqualTo({}) - .await(1, 5.seconds) + existingBucket.create(failsIfExists = + true + ) must beTypedEqualTo({}).await(1, 5.seconds) } and { existingBucket must existsIn( diff --git a/core/src/test/scala/StorageCommonSpec.scala b/core/src/test/scala/StorageCommonSpec.scala index fed6aac1..a76519e6 100644 --- a/core/src/test/scala/StorageCommonSpec.scala +++ b/core/src/test/scala/StorageCommonSpec.scala @@ -146,8 +146,9 @@ trait StorageCommonSpec extends BenjiMatchers with ErrorCommonSpec { bucket must notExistsIn(storage, 1, 10.seconds) and { // creating bucket - bucket.create(failsIfExists = true) must beTypedEqualTo({}) - .await(2, 3.seconds) + bucket.create(failsIfExists = + true + ) must beTypedEqualTo({}).await(2, 3.seconds) } and { bucket must existsIn(storage, rwConsistencyRetry, rwConsistencyDuration) @@ -376,8 +377,9 @@ trait StorageCommonSpec extends BenjiMatchers with ErrorCommonSpec { { bucket must notExistsIn(storage, 1, 10.seconds) } and { - bucket.create(failsIfExists = true) must beTypedEqualTo({}) - .await(2, 5.seconds) + bucket.create(failsIfExists = + true + ) must beTypedEqualTo({}).await(2, 5.seconds) } and { bucket must existsIn(storage, 2, 7.seconds) } and { diff --git a/core/src/test/scala/VersioningCommonSpec.scala b/core/src/test/scala/VersioningCommonSpec.scala index e83132ce..c5cef4ed 100644 --- a/core/src/test/scala/VersioningCommonSpec.scala +++ b/core/src/test/scala/VersioningCommonSpec.scala @@ -58,9 +58,9 @@ trait VersioningCommonSpec extends BenjiMatchers with ErrorCommonSpec { ({ bucket must notExistsIn(storage, 1, 3.seconds) }) and { - bucket.create(failsIfExists = true) must beTypedEqualTo({}) - .setMessage("created") - .await(2, 5.seconds) + bucket.create(failsIfExists = + true + ) must beTypedEqualTo({}).setMessage("created").await(2, 5.seconds) } and { bucket must existsIn(storage, 3, 3.seconds) } and { @@ -276,8 +276,9 @@ trait VersioningCommonSpec extends BenjiMatchers with ErrorCommonSpec { "to get the content and metadata of a specific version by reference" in { bucket.versioning must beSome[BucketVersioning].which { vbucket => ({ - bucket.create(failsIfExists = false) must beTypedEqualTo({}) - .await(2, 5.seconds) + bucket.create(failsIfExists = + false + ) must beTypedEqualTo({}).await(2, 5.seconds) }) and { bucket must existsIn(storage, 2, 3.seconds) .setMessage("bucket before") diff --git a/examples/play-vfs-compile-di/app/controllers/BenjiController.scala b/examples/play-vfs-compile-di/app/controllers/BenjiController.scala index 544266b7..bbef3201 100644 --- a/examples/play-vfs-compile-di/app/controllers/BenjiController.scala +++ b/examples/play-vfs-compile-di/app/controllers/BenjiController.scala @@ -92,8 +92,12 @@ class BenjiController( } def deleteObject(bucketName: String, objectName: String) = Action.async { - benji.bucket(bucketName).obj(objectName).delete.ignoreIfNotExists.apply().map { - _ => NoContent - } + benji + .bucket(bucketName) + .obj(objectName) + .delete + .ignoreIfNotExists + .apply() + .map { _ => NoContent } } } diff --git a/google/src/main/scala/GoogleObjectRef.scala b/google/src/main/scala/GoogleObjectRef.scala index 6a0ace80..af4c53d8 100644 --- a/google/src/main/scala/GoogleObjectRef.scala +++ b/google/src/main/scala/GoogleObjectRef.scala @@ -598,50 +598,57 @@ final class GoogleObjectRef private[google] ( ): Source[VersionedObject, NotUsed] = { implicit val ec: ExecutionContext = m.executionContext - Source.fromFutureSource(Future { - val prepared = - gt.client.objects().list(bucket).setVersions(true).setPrefix(name) - val maxed = maybeMax.fold(prepared) { prepared.setMaxResults(_) } - - val request = - nextToken.fold(maxed.execute()) { maxed.setPageToken(_).execute() } - - val (currentPage, empty) = Option(request.getItems) match { - case Some(items) => - val collection = items.asScala.filter(_.getName == name) - val source = Source.fromIterator[VersionedObject] { () => - collection.iterator.map { (obj: StorageObject) => - VersionedObject( - obj.getName, - Bytes(obj.getSize.longValue), - LocalDateTime.ofInstant( - Instant.ofEpochMilli(obj.getUpdated.getValue), - ZoneOffset.UTC - ), - obj.getGeneration.toString, - obj.getTimeDeleted == null - ) + Source.fromFutureSource( + Future { + val prepared = + gt.client.objects().list(bucket).setVersions(true).setPrefix(name) + val maxed = maybeMax.fold(prepared) { prepared.setMaxResults(_) } + + val request = + nextToken.fold(maxed.execute()) { maxed.setPageToken(_).execute() } + + val (currentPage, empty) = Option(request.getItems) match { + case Some(items) => + val collection = items.asScala.filter(_.getName == name) + val source = Source.fromIterator[VersionedObject] { () => + collection.iterator.map { (obj: StorageObject) => + VersionedObject( + obj.getName, + Bytes(obj.getSize.longValue), + LocalDateTime.ofInstant( + Instant.ofEpochMilli(obj.getUpdated.getValue), + ZoneOffset.UTC + ), + obj.getGeneration.toString, + obj.getTimeDeleted == null + ) + } } - } - (source, collection.isEmpty) + (source, collection.isEmpty) - case _ => (Source.empty[VersionedObject], true) - } + case _ => (Source.empty[VersionedObject], true) + } - Option(request.getNextPageToken) match { - case nextPageToken @ Some(_) => - currentPage ++ apply( - nextPageToken, - maybeEmpty = maybeEmpty && empty - ) + Option(request.getNextPageToken) match { + case nextPageToken @ Some(_) => + currentPage ++ apply( + nextPageToken, + maybeEmpty = maybeEmpty && empty + ) - case _ => - if (maybeEmpty && empty) - throw ObjectNotFoundException(ref) - else - currentPage - } - }.recoverWith(ErrorHandler.ofObjectToFuture(s"Could not list versions of object $name inside bucket $bucket", ref))) + case _ => + if (maybeEmpty && empty) + throw ObjectNotFoundException(ref) + else + currentPage + } + }.recoverWith( + ErrorHandler.ofObjectToFuture( + s"Could not list versions of object $name inside bucket $bucket", + ref + ) + ) + ) }.mapMaterializedValue(_ => NotUsed) def apply( diff --git a/google/src/test/scala/GoogleStorageSpec.scala b/google/src/test/scala/GoogleStorageSpec.scala index 4cb2fa7f..181f0ded 100644 --- a/google/src/test/scala/GoogleStorageSpec.scala +++ b/google/src/test/scala/GoogleStorageSpec.scala @@ -40,8 +40,9 @@ final class GoogleStorageSpec( lazy val gbucket = google.bucket(bucketName) s"Create another bucket $bucketName" in { - gbucket.create(failsIfExists = true) must beTypedEqualTo({}) - .await(0, 5.seconds) + gbucket.create(failsIfExists = + true + ) must beTypedEqualTo({}).await(0, 5.seconds) } val objName = "testfile.txt" diff --git a/s3/src/main/scala/WSS3VersionedObjectRef.scala b/s3/src/main/scala/WSS3VersionedObjectRef.scala index 19c653ef..4b6897a1 100644 --- a/s3/src/main/scala/WSS3VersionedObjectRef.scala +++ b/s3/src/main/scala/WSS3VersionedObjectRef.scala @@ -218,9 +218,8 @@ final class WSS3VersionedObjectRef( if (skipMarkers) multiDeleteSimulated(Seq(self)) else - markersToDelete().flatMap(markers => - multiDeleteSimulated(self +: markers) - ) + markersToDelete() + .flatMap(markers => multiDeleteSimulated(self +: markers)) } def ignoreIfNotExists: WSS3DeleteRequest = copy(ignoreExists = true)