From adbb0df1a16e5cafdcf4263a6d4d34eaaea7812b Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 9 Jun 2025 22:05:15 +0000 Subject: [PATCH 1/3] [3.0.x] scalafmt-core 3.9.7 (was 3.9.6) --- .scalafmt.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index 4922e67..723dec8 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -13,4 +13,4 @@ rewrite.rules = [ AvoidInfix, ExpandImportSelectors, RedundantParens, SortModifi rewrite.sortModifiers.order = [ "private", "protected", "final", "sealed", "abstract", "implicit", "override", "lazy" ] spaces.inImportCurlyBraces = true # more idiomatic to include whitepsace in import x.{ yyy } trailingCommas = preserve -version = 3.9.6 +version = 3.9.7 From fa901af121af0329e7bfcc215f4cda57c9cb33cd Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 9 Jun 2025 22:05:38 +0000 Subject: [PATCH 2/3] Reformat with scalafmt 3.9.7 Executed command: scalafmt --non-interactive --- build.sbt | 2 +- .../cachecontrol/CacheDefaults.scala | 2 +- .../cachecontrol/CacheDirectiveParser.scala | 6 +++--- .../CacheDirectiveParserCompat.scala | 2 +- .../CacheDirectiveParserSpec.scala | 2 +- .../ResponseCachingCalculatorSpec.scala | 18 +++++++++--------- .../ResponseSelectionCalculatorSpec.scala | 2 +- .../ResponseServingcalculatorSpec.scala | 10 +++++----- .../SecondaryKeyCalculatorSpec.scala | 4 ++-- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/build.sbt b/build.sbt index 391c9af..a13624e 100644 --- a/build.sbt +++ b/build.sbt @@ -22,7 +22,7 @@ lazy val cachecontrol = (project in file(".")) slf4jSimple % Test ), mimaPreviousArtifacts := previousVersion.map(organization.value %% moduleName.value % _).toSet, - headerLicense := { + headerLicense := { Some( HeaderLicense.Custom( s"Copyright (C) from 2022 The Play Framework Contributors , 2011-2021 Lightbend Inc. " diff --git a/src/main/scala/org/playframework/cachecontrol/CacheDefaults.scala b/src/main/scala/org/playframework/cachecontrol/CacheDefaults.scala index a08a5b8..4b6f967 100644 --- a/src/main/scala/org/playframework/cachecontrol/CacheDefaults.scala +++ b/src/main/scala/org/playframework/cachecontrol/CacheDefaults.scala @@ -116,7 +116,7 @@ trait CacheDefaults extends Cache { while (nominatedHeadersIter.hasNext) { val nominatedHeaderName = nominatedHeadersIter.next() presentedHeaders.get(nominatedHeaderName) match { - case None => return false + case None => return false case Some(presentedHeaderValues) => val nominatedHeaderValues = nominatedHeaders(nominatedHeaderName) // There's a list of header values, so we need a way to normalize it. diff --git a/src/main/scala/org/playframework/cachecontrol/CacheDirectiveParser.scala b/src/main/scala/org/playframework/cachecontrol/CacheDirectiveParser.scala index 5454116..e944b31 100644 --- a/src/main/scala/org/playframework/cachecontrol/CacheDirectiveParser.scala +++ b/src/main/scala/org/playframework/cachecontrol/CacheDirectiveParser.scala @@ -52,9 +52,9 @@ object CacheDirectiveParser { * * These patterns are translated directly using the same naming */ - val ctl = acceptIf { c => (c >= 0 && c <= 0x1f) || c.toInt == 0x7f }(_ => "Expected a control character") - val char = acceptIf(_ < 0x80)(_ => "Expected an ascii character") - val text = not(ctl) ~> any + val ctl = acceptIf { c => (c >= 0 && c <= 0x1f) || c.toInt == 0x7f }(_ => "Expected a control character") + val char = acceptIf(_ < 0x80)(_ => "Expected an ascii character") + val text = not(ctl) ~> any val separators = { acceptIf(c => separatorBitSet(c.toInt))(_ => "Expected one of " + separatorChars) } diff --git a/src/main/scala/org/playframework/cachecontrol/CacheDirectiveParserCompat.scala b/src/main/scala/org/playframework/cachecontrol/CacheDirectiveParserCompat.scala index dba778f..66fee96 100644 --- a/src/main/scala/org/playframework/cachecontrol/CacheDirectiveParserCompat.scala +++ b/src/main/scala/org/playframework/cachecontrol/CacheDirectiveParserCompat.scala @@ -8,7 +8,7 @@ object CacheDirectiveParserCompat { def toImmutableSeq[T](seq: Seq[T]): scala.collection.immutable.Seq[T] = { seq match { case xs: scala.collection.immutable.Seq[T @unchecked] => xs - case _ => + case _ => val b = scala.collection.immutable.Seq.newBuilder[T] seq.iterator.foreach(b += _) b.result() diff --git a/src/test/scala/org/playframework/cachecontrol/CacheDirectiveParserSpec.scala b/src/test/scala/org/playframework/cachecontrol/CacheDirectiveParserSpec.scala index 501c898..c02ccbf 100644 --- a/src/test/scala/org/playframework/cachecontrol/CacheDirectiveParserSpec.scala +++ b/src/test/scala/org/playframework/cachecontrol/CacheDirectiveParserSpec.scala @@ -154,7 +154,7 @@ class CacheDirectiveParserSpec extends AnyWordSpec { "parse random input as cache directives" in { // include embedded commas to make things interesting... - val directives = CacheDirectiveParser.parse(Seq("""i, have, no=idea, what="I'm, doing"""")) + val directives = CacheDirectiveParser.parse(Seq("""i, have, no=idea, what="I'm, doing"""")) val badSequence = Seq( CacheDirectiveExtension("i", None), CacheDirectiveExtension("have", None), diff --git a/src/test/scala/org/playframework/cachecontrol/ResponseCachingCalculatorSpec.scala b/src/test/scala/org/playframework/cachecontrol/ResponseCachingCalculatorSpec.scala index 5b66ed6..37745ed 100644 --- a/src/test/scala/org/playframework/cachecontrol/ResponseCachingCalculatorSpec.scala +++ b/src/test/scala/org/playframework/cachecontrol/ResponseCachingCalculatorSpec.scala @@ -173,10 +173,10 @@ class ResponseCachingCalculatorSpec extends AnyWordSpec { "with qualified private and qualified no-cache response directives" should { "return DoCache with only no-cache stripped headers when private" in { import CacheDirectives._ - val policy = new ResponseCachingCalculator(privateCache) - val request: CacheRequest = defaultRequest - val noCache = NoCache(Some(List("Set-Cookie"))) - val privDirective = Private(Some(List("Some-Header"))) + val policy = new ResponseCachingCalculator(privateCache) + val request: CacheRequest = defaultRequest + val noCache = NoCache(Some(List("Set-Cookie"))) + val privDirective = Private(Some(List("Some-Header"))) val response: OriginResponse = defaultResponse.copy(headers = h(privDirective.toString + "," + noCache.toString)) val result = policy.isCacheable(request, response) @@ -185,10 +185,10 @@ class ResponseCachingCalculatorSpec extends AnyWordSpec { "return DoCache with both stripped headers when shared cache" in { import CacheDirectives._ - val policy = new ResponseCachingCalculator(sharedCache) - val request: CacheRequest = defaultRequest - val noCache = NoCache(Some(List("Set-Cookie"))) - val privDirective = Private(Some(List("Some-Header"))) + val policy = new ResponseCachingCalculator(sharedCache) + val request: CacheRequest = defaultRequest + val noCache = NoCache(Some(List("Set-Cookie"))) + val privDirective = Private(Some(List("Some-Header"))) val response: OriginResponse = defaultResponse.copy(headers = h(privDirective.toString + "," + noCache.toString)) val result = policy.isCacheable(request, response) @@ -241,7 +241,7 @@ class ResponseCachingCalculatorSpec extends AnyWordSpec { "with a containsCachableExtension" should { "return DoCacheResponse" in { - var called = false + var called = false val cacheWithExtensions = new StubCache(shared = false) { override def isCacheableExtension(extension: CacheDirectives.CacheDirectiveExtension): Boolean = { called = extension.name == "public-on-tuesday" diff --git a/src/test/scala/org/playframework/cachecontrol/ResponseSelectionCalculatorSpec.scala b/src/test/scala/org/playframework/cachecontrol/ResponseSelectionCalculatorSpec.scala index 69343d0..bffba3b 100644 --- a/src/test/scala/org/playframework/cachecontrol/ResponseSelectionCalculatorSpec.scala +++ b/src/test/scala/org/playframework/cachecontrol/ResponseSelectionCalculatorSpec.scala @@ -113,7 +113,7 @@ class ResponseSelectionCalculatorSpec extends AnyWordSpec { val policy = new ResponseSelectionCalculator(cache) val presentingHeaders = Map(HeaderName("X-Custom-Header") -> Seq("value1")) val request = defaultRequest.copy(headers = presentingHeaders) - val nominatedHeaders = + val nominatedHeaders = Map(HeaderName("X-Custom-Header") -> Seq("value1"), HeaderName("X-Custom-Header") -> Seq("value2")) val response = defaultResponse.copy(nominatedHeaders = nominatedHeaders) val action = policy.selectResponse(request, Seq(response)) diff --git a/src/test/scala/org/playframework/cachecontrol/ResponseServingcalculatorSpec.scala b/src/test/scala/org/playframework/cachecontrol/ResponseServingcalculatorSpec.scala index 62e3283..123197e 100644 --- a/src/test/scala/org/playframework/cachecontrol/ResponseServingcalculatorSpec.scala +++ b/src/test/scala/org/playframework/cachecontrol/ResponseServingcalculatorSpec.scala @@ -44,7 +44,7 @@ class ResponseServingCalculatorSpec extends AnyWordSpec { "return Validate" in { val policy = new ResponseServingCalculator(privateCache) - val request = defaultRequest.copy(headers = defaultRequest.headers ++ Map(`Cache-Control` -> Seq("no-cache"))) + val request = defaultRequest.copy(headers = defaultRequest.headers ++ Map(`Cache-Control` -> Seq("no-cache"))) val response = defaultResponse.copy(headers = defaultResponse.headers ++ Map(`Cache-Control` -> Seq("max-age=60"))) @@ -58,12 +58,12 @@ class ResponseServingCalculatorSpec extends AnyWordSpec { "return Validate" in { val policy = new ResponseServingCalculator(privateCache) - val request = defaultRequest.copy(headers = defaultRequest.headers ++ Map(`Pragma` -> Seq("no-cache"))) + val request = defaultRequest.copy(headers = defaultRequest.headers ++ Map(`Pragma` -> Seq("no-cache"))) val response = defaultResponse.copy(headers = defaultResponse.headers ++ Map(`Cache-Control` -> Seq("max-age=60"))) val action: ResponseServeAction = policy.serveResponse(request, response, Duration.ofSeconds(5)) - val msg = + val msg = "Request does not contain Cache-Control header found, but does contains no-cache Pragma header, validation required" action should be(Validate(msg)) } @@ -73,7 +73,7 @@ class ResponseServingCalculatorSpec extends AnyWordSpec { "return ServeFresh when fresh" in { val policy = new ResponseServingCalculator(privateCache) - val request = defaultRequest.copy(headers = defaultRequest.headers ++ Map(`Cache-Control` -> Seq("no-store"))) + val request = defaultRequest.copy(headers = defaultRequest.headers ++ Map(`Cache-Control` -> Seq("no-store"))) val response = defaultResponse.copy(headers = defaultResponse.headers ++ Map(`Cache-Control` -> Seq("publish,max-age=60"))) @@ -85,7 +85,7 @@ class ResponseServingCalculatorSpec extends AnyWordSpec { "return Validate when stale" in { val policy = new ResponseServingCalculator(privateCache) - val request = defaultRequest.copy(headers = defaultRequest.headers ++ Map(`Cache-Control` -> Seq("no-store"))) + val request = defaultRequest.copy(headers = defaultRequest.headers ++ Map(`Cache-Control` -> Seq("no-store"))) val response = defaultResponse.copy(headers = defaultResponse.headers ++ Map(`Cache-Control` -> Seq("publish,max-age=60"))) diff --git a/src/test/scala/org/playframework/cachecontrol/SecondaryKeyCalculatorSpec.scala b/src/test/scala/org/playframework/cachecontrol/SecondaryKeyCalculatorSpec.scala index 1d7b8ec..09619be 100644 --- a/src/test/scala/org/playframework/cachecontrol/SecondaryKeyCalculatorSpec.scala +++ b/src/test/scala/org/playframework/cachecontrol/SecondaryKeyCalculatorSpec.scala @@ -12,8 +12,8 @@ import org.scalatest.wordspec.AnyWordSpec class SecondaryKeyCalculatorSpec extends AnyWordSpec { def responseHeaders = { - val now = HttpDate.now - val age = Duration.ofSeconds(60) + val now = HttpDate.now + val age = Duration.ofSeconds(60) val headers = Map( `Date` -> Seq(HttpDate.format(now)), `Age` -> Seq(age.getSeconds.toString), From 7f4f6938da7f5c94dd73d3248747d8c59eb2d033 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 9 Jun 2025 22:05:38 +0000 Subject: [PATCH 3/3] Add 'Reformat with scalafmt 3.9.7' 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 0c5c235..6cf3a47 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,2 +1,5 @@ # Scala Steward: Reformat with scalafmt 3.8.3 74504eabba695079dc83931746f073bc5eeb9a38 + +# Scala Steward: Reformat with scalafmt 3.9.7 +fa901af121af0329e7bfcc215f4cda57c9cb33cd