Skip to content

Commit

Permalink
Merge pull request #3284 from scala-steward/update/scalafmt-core-3.8.5
Browse files Browse the repository at this point in the history
Update scalafmt-core to 3.8.5
  • Loading branch information
Philippus authored Jan 19, 2025
2 parents eef2d75 + 1977ad5 commit 83c2820
Show file tree
Hide file tree
Showing 25 changed files with 150 additions and 44 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 applied scalafmtAll and scalafmtSbt
c1a068b59a36f88401ea646577e4ed61df1e1b4a

# Scala Steward: Reformat with scalafmt 3.8.5
fb60074fc43b054aab8aa17c4d5bc87106c7ae9e
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.8.3
version = 3.8.5

align.preset = most
literals.double = Upper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import org.scalatest.matchers.should.Matchers
class ScriptBuilderFnTest extends AnyFunSuite with Matchers {

test("should handle recursive maps") {
ScriptBuilderFn(Script("myscript", params = Map("a" -> 1.2, "b" -> Map("c" -> true, "d" -> List(Map("e" -> 3)))))).string shouldBe
ScriptBuilderFn(Script(
"myscript",
params = Map("a" -> 1.2, "b" -> Map("c" -> true, "d" -> List(Map("e" -> 3))))
)).string shouldBe
"""{"source":"myscript","params":{"a":1.2,"b":{"c":true,"d":[{"e":3}]}}}"""
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ class SourceAsContentBuilderTest extends AnyFunSuite with Matchers {

test("source as content builder should handle tuples") {
val map = Map("name" -> "sammy", "teams" -> Seq(("football", "boro"), ("baseball", "phillies")), "projects" -> null)
SourceAsContentBuilder(map).string shouldBe """{"name":"sammy","teams":[["football","boro"],["baseball","phillies"]],"projects":null}"""
SourceAsContentBuilder(
map
).string shouldBe """{"name":"sammy","teams":[["football","boro"],["baseball","phillies"]],"projects":null}"""
}

test("source as content builder should handle bigdecimals") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class NormalizerBuilderTest extends AnyFunSuite with Matchers {

test("should build normalizer to spec") {
val n = CustomNormalizer("my_normalizer", List("quote"), List("lowercase", "asciifolding"))
NormalizerBuilder.build(n).string shouldBe """{"type":"custom","filter":["lowercase","asciifolding"],"char_filter":["quote"]}"""
NormalizerBuilder.build(
n
).string shouldBe """{"type":"custom","filter":["lowercase","asciifolding"],"char_filter":["quote"]}"""
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class UpdateIndexLevelSettingsBuilderTest extends AnyFunSuite with Matchers {
settings = Map("index.blocks.write" -> true.toString)
)

UpdateIndexLevelSettingsBuilder(definition).string shouldBe """{"settings":{"index.blocks.write":"true","index.number_of_replicas":0}}"""
UpdateIndexLevelSettingsBuilder(
definition
).string shouldBe """{"settings":{"index.blocks.write":"true","index.number_of_replicas":0}}"""
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ class MultiSearchBuilderFnTest extends AnyWordSpec with Matchers {
}
"build multisearch request with ignore_unavailable indices option" in {
val req = searchRequest indicesOptions IndicesOptionsRequest(ignoreUnavailable = true)
MultiSearchBuilderFn(multi(req)).linesIterator.next shouldBe """{"index":"someIndex","ignore_unavailable":"true"}"""
MultiSearchBuilderFn(
multi(req)
).linesIterator.next shouldBe """{"index":"someIndex","ignore_unavailable":"true"}"""

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ class FingerprintAnalyzerBuilderTest extends AnyWordSpec with Matchers {

"FingerprintAnalyzer" should {
"build json" in {
FingerprintAnalyzer("testy").separator("-").maxOutputSize(123).stopwords("a", "z").build.string shouldBe """{"type":"fingerprint","separator":"-","stopwords":["a","z"],"max_output_size":123}"""
FingerprintAnalyzer("testy").separator("-").maxOutputSize(123).stopwords(
"a",
"z"
).build.string shouldBe """{"type":"fingerprint","separator":"-","stopwords":["a","z"],"max_output_size":123}"""
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ class PatternAnalyzerBuilderTest extends AnyWordSpec with Matchers {

"PatternAnalyzer" should {
"build json" in {
PatternAnalyzer("testy", regex = "21.*").lowercase(true).build.string shouldBe """{"type":"pattern","lowercase":true,"pattern":"21.*"}"""
PatternAnalyzer(
"testy",
regex = "21.*"
).lowercase(true).build.string shouldBe """{"type":"pattern","lowercase":true,"pattern":"21.*"}"""
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ class EdgeNGramTokenizerBuilderTest extends AnyWordSpec with Matchers with Elast

"EdgeNGramTokenizer" should {
"build json" in {
EdgeNGramTokenizer("testy").minMaxGrams(2, 3).tokenChars("a", "z").build.string shouldBe """{"type":"edge_ngram","min_gram":2,"max_gram":3,"token_chars":["a","z"]}"""
EdgeNGramTokenizer("testy").minMaxGrams(2, 3).tokenChars(
"a",
"z"
).build.string shouldBe """{"type":"edge_ngram","min_gram":2,"max_gram":3,"token_chars":["a","z"]}"""
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,41 @@ class XContentBuilderTest extends AnyFunSuite with Matchers {
}

test("should support raw fields in objects") {
XContentFactory.obj().rawField("nested", """{"test":true,"name":"foo"}""").string shouldBe """{"nested":{"test":true,"name":"foo"}}"""
XContentFactory.obj().rawField(
"nested",
"""{"test":true,"name":"foo"}"""
).string shouldBe """{"nested":{"test":true,"name":"foo"}}"""
}

test("should support raw values in arrays") {
XContentFactory.array().rawValue("""{"test":true,"name":"foo"}""").string shouldBe """[{"test":true,"name":"foo"}]"""
XContentFactory.array().rawValue(
"""{"test":true,"name":"foo"}"""
).string shouldBe """[{"test":true,"name":"foo"}]"""
}

test("should support boolean arrays") {
XContentFactory.obj().array("booleans", Array(true, false, true)).string shouldBe """{"booleans":[true,false,true]}"""
XContentFactory.obj().array(
"booleans",
Array(true, false, true)
).string shouldBe """{"booleans":[true,false,true]}"""
}

test("should support double arrays") {
XContentFactory.obj().array("doubles", Array(124.45, 962.23)).string shouldBe """{"doubles":[124.45,962.23]}"""
}

test("should support biginteger arrays") {
XContentFactory.obj().autoarray("bigintegers", Seq(new BigInteger("123"), new BigInteger("456"))).string shouldBe """{"bigintegers":[123,456]}"""
XContentFactory.obj().autoarray(
"bigintegers",
Seq(new BigInteger("123"), new BigInteger("456"))
).string shouldBe """{"bigintegers":[123,456]}"""
}

test("should support long arrays") {
XContentFactory.obj().array("longs", Array(345345435345L, 3257059014L)).string shouldBe """{"longs":[345345435345,3257059014]}"""
XContentFactory.obj().array(
"longs",
Array(345345435345L, 3257059014L)
).string shouldBe """{"longs":[345345435345,3257059014]}"""
}

test("should support string arrays") {
Expand All @@ -58,15 +72,24 @@ class XContentBuilderTest extends AnyFunSuite with Matchers {
}

test("should support bigdecimal fields") {
XContentFactory.obj().field("dec", BigDecimal("291839123.12321312")).string shouldBe """{"dec":291839123.12321312}"""
XContentFactory.obj().field(
"dec",
BigDecimal("291839123.12321312")
).string shouldBe """{"dec":291839123.12321312}"""
}

test("should support bigint fields") {
XContentFactory.obj().field("bigint", BigInt("98123981231982361893619")).string shouldBe """{"bigint":98123981231982361893619}"""
XContentFactory.obj().field(
"bigint",
BigInt("98123981231982361893619")
).string shouldBe """{"bigint":98123981231982361893619}"""
}

test("should support biginteger fields") {
XContentFactory.obj().autofield("biginteger", new BigInteger("98123981231982361893619")).string shouldBe """{"biginteger":98123981231982361893619}"""
XContentFactory.obj().autofield(
"biginteger",
new BigInteger("98123981231982361893619")
).string shouldBe """{"biginteger":98123981231982361893619}"""
}

test("should support iterable fields") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,50 @@ class CompoundWordTokenFilterTest extends AnyWordSpec with TokenFilterApi with M

"CompoundWordTokenFilter builder" should {
"set type" in {
compoundWordTokenFilter("testy", DictionaryDecompounder).json.string shouldBe """{"type":"dictionary_decompounder"}"""
compoundWordTokenFilter(
"testy",
DictionaryDecompounder
).json.string shouldBe """{"type":"dictionary_decompounder"}"""
}
"set word list" in {
compoundWordTokenFilter("testy", HyphenationDecompounder).wordList("boo", "foo").json.string shouldBe """{"type":"hyphenation_decompounder","word_list":["boo","foo"]}"""
compoundWordTokenFilter(
"testy",
HyphenationDecompounder
).wordList("boo", "foo").json.string shouldBe """{"type":"hyphenation_decompounder","word_list":["boo","foo"]}"""
}
"set word list path" in {
compoundWordTokenFilter("testy", HyphenationDecompounder).wordListPath("config/word.txt").json.string shouldBe """{"type":"hyphenation_decompounder","word_list_path":"config/word.txt"}"""
compoundWordTokenFilter("testy", HyphenationDecompounder).wordListPath(
"config/word.txt"
).json.string shouldBe """{"type":"hyphenation_decompounder","word_list_path":"config/word.txt"}"""
}
"set hyphenation patterns path" in {
compoundWordTokenFilter("testy", HyphenationDecompounder).wordListPath("config/hyphens.txt").json.string shouldBe """{"type":"hyphenation_decompounder","word_list_path":"config/hyphens.txt"}"""
compoundWordTokenFilter("testy", HyphenationDecompounder).wordListPath(
"config/hyphens.txt"
).json.string shouldBe """{"type":"hyphenation_decompounder","word_list_path":"config/hyphens.txt"}"""
}
"set min word size" in {
compoundWordTokenFilter("testy", HyphenationDecompounder).minWordSize(7).json.string shouldBe """{"type":"hyphenation_decompounder","min_word_size":7}"""
compoundWordTokenFilter(
"testy",
HyphenationDecompounder
).minWordSize(7).json.string shouldBe """{"type":"hyphenation_decompounder","min_word_size":7}"""
}
"set min subword size" in {
compoundWordTokenFilter("testy", HyphenationDecompounder).minSubwordSize(3).json.string shouldBe """{"type":"hyphenation_decompounder","min_subword_size":3}"""
compoundWordTokenFilter(
"testy",
HyphenationDecompounder
).minSubwordSize(3).json.string shouldBe """{"type":"hyphenation_decompounder","min_subword_size":3}"""
}
"set max subword size" in {
compoundWordTokenFilter("testy", HyphenationDecompounder).maxSubwordSize(18).json.string shouldBe """{"type":"hyphenation_decompounder","max_subword_size":18}"""
compoundWordTokenFilter(
"testy",
HyphenationDecompounder
).maxSubwordSize(18).json.string shouldBe """{"type":"hyphenation_decompounder","max_subword_size":18}"""
}
"set only longest match" in {
compoundWordTokenFilter("testy", HyphenationDecompounder).onlyLongestMatch(true).json.string shouldBe """{"type":"hyphenation_decompounder","only_longest_match":true}"""
compoundWordTokenFilter(
"testy",
HyphenationDecompounder
).onlyLongestMatch(true).json.string shouldBe """{"type":"hyphenation_decompounder","only_longest_match":true}"""
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ class EdgeNGramTokenizerTest extends AnyWordSpec with TokenizerApi with Matchers

"EdgeNGramTokenizer builder" should {
"set min and max ngrams" in {
edgeNGramTokenizer("testy").minMaxGrams(3, 4).json.string shouldBe """{"type":"edgeNGram","min_gram":3,"max_gram":4}"""
edgeNGramTokenizer("testy").minMaxGrams(
3,
4
).json.string shouldBe """{"type":"edgeNGram","min_gram":3,"max_gram":4}"""
}
"set token chars" in {
edgeNGramTokenizer("testy")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,25 @@ class KeywordMarkerTokenFilterTest extends AnyWordSpec with TokenFilterApi with
keywordMarkerTokenFilter("testy").json.string shouldBe """{"type":"keyword_marker"}"""
}
"set keywords" in {
keywordMarkerTokenFilter("testy").keywords("foo", "bar").json.string shouldBe """{"type":"keyword_marker","keywords":["foo","bar"]}"""
keywordMarkerTokenFilter("testy").keywords(
"foo",
"bar"
).json.string shouldBe """{"type":"keyword_marker","keywords":["foo","bar"]}"""
}
"set keywords path" in {
keywordMarkerTokenFilter("testy").keywordsPath("config/keywords.txt").json.string shouldBe """{"type":"keyword_marker","keywords_path":"config/keywords.txt"}"""
keywordMarkerTokenFilter("testy").keywordsPath(
"config/keywords.txt"
).json.string shouldBe """{"type":"keyword_marker","keywords_path":"config/keywords.txt"}"""
}
"set keywords pattern" in {
keywordMarkerTokenFilter("testy").keywordsPattern("pattern").json.string shouldBe """{"type":"keyword_marker","keywords_pattern":"pattern"}"""
keywordMarkerTokenFilter(
"testy"
).keywordsPattern("pattern").json.string shouldBe """{"type":"keyword_marker","keywords_pattern":"pattern"}"""
}
"set ignore case" in {
keywordMarkerTokenFilter("testy").ignoreCase(true).json.string shouldBe """{"type":"keyword_marker","ignore_case":true}"""
keywordMarkerTokenFilter(
"testy"
).ignoreCase(true).json.string shouldBe """{"type":"keyword_marker","ignore_case":true}"""
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ class LimitTokenCountTokenFilterTest extends AnyWordSpec with TokenFilterApi wit
limitTokenCountTokenFilter("testy").json.string shouldBe """{"type":"limit"}"""
}
"set max token count" in {
limitTokenCountTokenFilter("testy").maxTokenCount(7).json.string shouldBe """{"type":"limit","max_token_count":7}"""
limitTokenCountTokenFilter(
"testy"
).maxTokenCount(7).json.string shouldBe """{"type":"limit","max_token_count":7}"""
}
"set consume all tokens" in {
limitTokenCountTokenFilter("testy").consumeAllTokens(true).json.string shouldBe """{"type":"limit","consume_all_tokens":true}"""
limitTokenCountTokenFilter(
"testy"
).consumeAllTokens(true).json.string shouldBe """{"type":"limit","consume_all_tokens":true}"""
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ class PatternTokenizerTest extends AnyWordSpec with TokenizerApi with Matchers {

"PatternTokenizer builder" should {
"set flags" in {
patternTokenizer("testy").flags("abc").json.string shouldBe """{"type":"pattern","flags":"abc","pattern":"\\W+"}"""
patternTokenizer(
"testy"
).flags("abc").json.string shouldBe """{"type":"pattern","flags":"abc","pattern":"\\W+"}"""
}
"not set flags if not specified" in {
patternTokenizer("testy").json.string shouldBe """{"type":"pattern","pattern":"\\W+"}"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@ class ShingleTokenFilterTest extends AnyWordSpec with TokenFilterApi with Matche
shingleTokenFilter("testy").minShingleSize(11).json.string shouldBe """{"type":"shingle","min_shingle_size":11}"""
}
"set output unigrams" in {
shingleTokenFilter("testy").outputUnigrams(false).json.string shouldBe """{"type":"shingle","output_unigrams":false}"""
shingleTokenFilter(
"testy"
).outputUnigrams(false).json.string shouldBe """{"type":"shingle","output_unigrams":false}"""
}
"set output unigrams if no shingles" in {
shingleTokenFilter("testy").outputUnigramsIfNoShingles(true).json.string shouldBe """{"type":"shingle","output_unigrams_if_no_shingles":true}"""
shingleTokenFilter("testy").outputUnigramsIfNoShingles(
true
).json.string shouldBe """{"type":"shingle","output_unigrams_if_no_shingles":true}"""
}
"set token separator" in {
shingleTokenFilter("testy").tokenSeparator("/").json.string shouldBe """{"type":"shingle","token_separator":"/"}"""
shingleTokenFilter(
"testy"
).tokenSeparator("/").json.string shouldBe """{"type":"shingle","token_separator":"/"}"""
}
"set filler token" in {
shingleTokenFilter("testy").fillerToken("-").json.string shouldBe """{"type":"shingle","filler_token":"-"}"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ class StopTokenFilterTest extends AnyWordSpec with TokenFilterApi with Matchers

"StopTokenFilter builder" should {
"set stop words" in {
stopTokenFilter("testy").stopwords("boo", "foo").json.string shouldBe """{"type":"stop","stopwords":["boo","foo"]}"""
stopTokenFilter("testy").stopwords(
"boo",
"foo"
).json.string shouldBe """{"type":"stop","stopwords":["boo","foo"]}"""
}
"set ignore case" in {
stopTokenFilter("testy").ignoreCase(true).json.string shouldBe """{"type":"stop","ignore_case":true}"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ class UniqueTokenFilterTest extends AnyWordSpec with AnalyzerApi with Matchers w
uniqueTokenFilter("testy").json.string shouldBe """{"type":"unique"}"""
}
"set only same position" in {
uniqueTokenFilter("testy").onlyOnSamePosition(true).json.string shouldBe """{"type":"unique","only_on_same_position":true}"""
uniqueTokenFilter(
"testy"
).onlyOnSamePosition(true).json.string shouldBe """{"type":"unique","only_on_same_position":true}"""
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ class IndexTest extends AnyWordSpec with Matchers with DockerTests {

client.execute {
bulk(
indexInto("electronics").fields(Map("name" -> "galaxy", "screensize" -> 5)).withId("55A").version(42L).versionType(
indexInto("electronics").fields(Map(
"name" -> "galaxy",
"screensize" -> 5
)).withId("55A").version(42L).versionType(
VersionType.External
),
indexInto("electronics").fields(Map("name" -> "razor", "colours" -> Array("white", "blue"))),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ class UpdateByQueryTest
}.await

val task = client.execute {
updateByQueryAsync("pop", termsQuery("name", "coca")).script(script("ctx._source.foo = 'h'").lang("painless")).refreshImmediately
updateByQueryAsync(
"pop",
termsQuery("name", "coca")
).script(script("ctx._source.foo = 'h'").lang("painless")).refreshImmediately
}.await.result.task

// A bit ugly way to poll the task until it's complete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ class InnerHitTest extends AnyWordSpec with Matchers with DockerTests {
client.execute {
bulk(
indexInto(indexName).fields(Map("name" -> "boro", "affiliation" -> "club")).id("1").routing("1"),
indexInto(indexName).fields(Map("name" -> "traore", "affiliation" -> Map("name" -> "player", "parent" -> "1"))).id(
indexInto(indexName).fields(Map(
"name" -> "traore",
"affiliation" -> Map("name" -> "player", "parent" -> "1")
)).id(
"2"
).routing("1")
).refreshImmediately
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ object HttpClientExampleApp extends App {
client.execute {
bulk(
indexInto("myindex" / "mytype").fields("country" -> "Mongolia", "capital" -> "Ulaanbaatar"),
indexInto("myindex" / "mytype").fields("country" -> "Namibia", "capital" -> "Windhoek")
indexInto("myindex" / "mytype").fields("country" -> "Namibia", "capital" -> "Windhoek")
).refresh(RefreshPolicy.WaitFor)
}.await

Expand Down
Loading

0 comments on commit 83c2820

Please sign in to comment.