From 4b3cada90e24c51a7b7729981fdd34e51e02bd71 Mon Sep 17 00:00:00 2001 From: Piotr Chabelski Date: Mon, 9 Dec 2024 14:07:55 +0100 Subject: [PATCH] Bump `scalafmt` to 3.8.3 --- .scalafmt.conf | 2 +- publish/src/coursier/publish/MavenMetadata.scala | 4 +++- publish/src/coursier/publish/Pom.scala | 6 ++++-- publish/src/coursier/publish/dir/Dir.scala | 4 ++-- .../src/coursier/publish/download/FileDownload.scala | 10 +++++----- publish/src/coursier/publish/fileset/Group.scala | 3 ++- .../src/coursier/publish/logging/OutputFrame.scala | 2 +- publish/src/coursier/publish/signing/Signer.scala | 12 ++++++------ .../src/coursier/publish/sonatype/SonatypeApi.scala | 2 +- .../coursier/publish/sonatype/SonatypeTests.scala | 8 ++++---- 10 files changed, 29 insertions(+), 24 deletions(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index eb4d533..8c7e4cf 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = "3.2.1" +version = "3.8.3" align.preset = more maxColumn = 100 diff --git a/publish/src/coursier/publish/MavenMetadata.scala b/publish/src/coursier/publish/MavenMetadata.scala index 88dc699..e2a5e07 100644 --- a/publish/src/coursier/publish/MavenMetadata.scala +++ b/publish/src/coursier/publish/MavenMetadata.scala @@ -128,7 +128,9 @@ object MavenMetadata { {snapshotVersioning._1.format(timestampPattern)} {snapshotVersioning._2} - {now.atOffset(ZoneOffset.UTC).toLocalDateTime.format(lastUpdatedPattern)} + { + now.atOffset(ZoneOffset.UTC).toLocalDateTime.format(lastUpdatedPattern) + } { artifacts.map { diff --git a/publish/src/coursier/publish/Pom.scala b/publish/src/coursier/publish/Pom.scala index 827aea1..d5bc6a1 100644 --- a/publish/src/coursier/publish/Pom.scala +++ b/publish/src/coursier/publish/Pom.scala @@ -116,7 +116,7 @@ object Pom { {d.name} {d.url} - // + optional mail + // + optional mail } } @@ -131,7 +131,9 @@ object Pom { {depOrg.value} {depName.value} {ver} - {confOpt.fold[NodeSeq](Nil)(c => {c})} + { + confOpt.fold[NodeSeq](Nil)(c => {c}) + } } } diff --git a/publish/src/coursier/publish/dir/Dir.scala b/publish/src/coursier/publish/dir/Dir.scala index 0258898..0817ed7 100644 --- a/publish/src/coursier/publish/dir/Dir.scala +++ b/publish/src/coursier/publish/dir/Dir.scala @@ -31,7 +31,7 @@ object Dir { .flatMap(files) } finally if (s != null) - s.close() + s.close() } else // ??? @@ -69,7 +69,7 @@ object Dir { s.iterator().asScala.toVector.partition(Files.isDirectory(_)) } finally if (s != null) - s.close() + s.close() } val checkFiles = diff --git a/publish/src/coursier/publish/download/FileDownload.scala b/publish/src/coursier/publish/download/FileDownload.scala index add3911..72fc46b 100644 --- a/publish/src/coursier/publish/download/FileDownload.scala +++ b/publish/src/coursier/publish/download/FileDownload.scala @@ -25,11 +25,11 @@ final case class FileDownload(base: Path) extends Download { logger.downloadingIfExists(url) val res = try if (Files.isRegularFile(p)) { - val lastModified = Files.getLastModifiedTime(p).toInstant - Right(Some((Some(lastModified), Files.readAllBytes(p)))) - } - else - Right(None) + val lastModified = Files.getLastModifiedTime(p).toInstant + Right(Some((Some(lastModified), Files.readAllBytes(p)))) + } + else + Right(None) catch { case NonFatal(e) => Left(e) diff --git a/publish/src/coursier/publish/fileset/Group.scala b/publish/src/coursier/publish/fileset/Group.scala index 86d6667..f2b1e81 100644 --- a/publish/src/coursier/publish/fileset/Group.scala +++ b/publish/src/coursier/publish/fileset/Group.scala @@ -154,7 +154,8 @@ object Group { now: Instant ): Module = if ( - org.isEmpty && name.isEmpty && version.isEmpty && licenses.isEmpty && developers.isEmpty && homePage.isEmpty && gitDomainPath.isEmpty + org.isEmpty && name.isEmpty && version.isEmpty && licenses.isEmpty && developers + .isEmpty && homePage.isEmpty && gitDomainPath.isEmpty ) this else diff --git a/publish/src/coursier/publish/logging/OutputFrame.scala b/publish/src/coursier/publish/logging/OutputFrame.scala index 8c2b24d..3ea74cd 100644 --- a/publish/src/coursier/publish/logging/OutputFrame.scala +++ b/publish/src/coursier/publish/logging/OutputFrame.scala @@ -96,7 +96,7 @@ final class OutputFrame( var n = 0 while (n < bufferSize && it.hasNext) { val l = it.next() - // https://stackoverflow.com/a/25189932/3714539 + // https://stackoverflow.com/a/25189932/3714539 .replaceAll("\u001B\\[[\\d;]*[^\\d;]", "") val l0 = if (l.length <= width) l diff --git a/publish/src/coursier/publish/signing/Signer.scala b/publish/src/coursier/publish/signing/Signer.scala index b964a9b..08bac0f 100644 --- a/publish/src/coursier/publish/signing/Signer.scala +++ b/publish/src/coursier/publish/signing/Signer.scala @@ -63,12 +63,12 @@ trait Signer { .collect { case Left((path, content)) if !signed(path) && - !path.elements.lastOption.exists(n => - dontSignExtensions.exists(e => n.endsWith("." + e)) - ) && - !path.elements.lastOption.exists(n => - dontSignFiles(n) || dontSignFiles.exists(f => n.startsWith(f + ".")) - ) => + !path.elements.lastOption.exists(n => + dontSignExtensions.exists(e => n.endsWith("." + e)) + ) && + !path.elements.lastOption.exists(n => + dontSignFiles(n) || dontSignFiles.exists(f => n.startsWith(f + ".")) + ) => (path, content) } diff --git a/publish/src/coursier/publish/sonatype/SonatypeApi.scala b/publish/src/coursier/publish/sonatype/SonatypeApi.scala index 4b2ee4c..0382e78 100644 --- a/publish/src/coursier/publish/sonatype/SonatypeApi.scala +++ b/publish/src/coursier/publish/sonatype/SonatypeApi.scala @@ -68,7 +68,7 @@ final case class SonatypeApi( logger.listingProfiles(attempt, retryOnTimeout) val res = try get(s"$base/staging/profiles")(Profiles.Profile.listCodec) - .map(_.profile) + .map(_.profile) catch { case NonFatal(e) => logger.listedProfiles(Some(e)) diff --git a/publish/test/src/coursier/publish/sonatype/SonatypeTests.scala b/publish/test/src/coursier/publish/sonatype/SonatypeTests.scala index 53b7c44..55a74d5 100644 --- a/publish/test/src/coursier/publish/sonatype/SonatypeTests.scala +++ b/publish/test/src/coursier/publish/sonatype/SonatypeTests.scala @@ -46,10 +46,10 @@ object SonatypeTests extends TestSuite { ) try sonatypeApi3.sendPromoteStagingRepositoryRequest( - SonatypeApi.Profile("id", "name", "uri"), - "repo", - "description" - ) + SonatypeApi.Profile("id", "name", "uri"), + "repo", + "description" + ) catch { case e: Exception if e.getMessage == "Failed to get uri/promote (http status: 500, response: Internal server error)" =>