Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump com.diffplug.spotless from 6.20.0 to 6.25.0 #126

Merged
merged 3 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.diffplug.spotless" version "6.20.0"
id "com.diffplug.spotless" version "6.25.0"
id "io.freefair.lombok" version "8.4"
id "jacoco"
id "java-library"
Expand Down
2 changes: 1 addition & 1 deletion lib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "antlr"
id "com.diffplug.spotless" version "6.20.0"
id "com.diffplug.spotless" version "6.25.0"
id "io.freefair.lombok" version "8.4"
id "jacoco"
id "java-library"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,26 @@ class WikipediaTestTemplateProvider implements TemplateProvider {
public Optional<String> getTemplate(String template) {
String result =
switch (template) {
case "Template:Short description" -> "<template name='Short description'><parameter value='Delay or suspension of an activity or a law' /></template>";
case "Template:more citations needed" -> "<template name='more citations needed'><parameter key='date' value='April 2009' /></template>";
case "Template:clarify" -> "<template name='clarify'><parameter key='text' value='a delay of payment' /><parameter key='date' value='December 2015' /></template>";
case "Template:cite NIE" -> "<template name='cite NIE'><parameter key='wstitle' value='Moratorium' /><parameter key='year' value='1905' /></template>";
case "Template:cite web" -> "<template name='cite web'><parameter key='url' value='http://dictionary.reference.com/browse/moratorium?s=t' /><parameter key='title' value='definition of moratorium' /><parameter key='author' value='dictionary.com' /><parameter key='work' value='dictionary.com' /></template>";
case "Template:Short description" ->
"<template name='Short description'><parameter value='Delay or suspension of an activity or a law' /></template>";
case "Template:more citations needed" ->
"<template name='more citations needed'><parameter key='date' value='April 2009' /></template>";
case "Template:clarify" ->
"<template name='clarify'><parameter key='text' value='a delay of payment' /><parameter key='date' value='December 2015' /></template>";
case "Template:cite NIE" ->
"<template name='cite NIE'><parameter key='wstitle' value='Moratorium' /><parameter key='year' value='1905' /></template>";
case "Template:cite web" ->
"<template name='cite web'><parameter key='url' value='http://dictionary.reference.com/browse/moratorium?s=t' /><parameter key='title' value='definition of moratorium' /><parameter key='author' value='dictionary.com' /><parameter key='work' value='dictionary.com' /></template>";
case "Template:Authority control" -> "<template name='Authority control' />";
case "Template:Reflist" -> "<template name='Reflist' />";
case "Template:Law-term-stub" -> "<template name='Law-term-stub' />";
case "Template:wiktionary" -> "<template name='wiktionary'><parameter value='moratorium' /></template>";
default -> String.format(
"%s",
Assertions.fail(
String.format("Not expecting template '%s' to be needed", template)));
case "Template:wiktionary" ->
"<template name='wiktionary'><parameter value='moratorium' /></template>";
default ->
String.format(
"%s",
Assertions.fail(
String.format("Not expecting template '%s' to be needed", template)));
};
return Optional.of(result);
}
Expand Down
2 changes: 1 addition & 1 deletion preprocessor/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "antlr"
id "com.diffplug.spotless" version "6.20.0"
id "com.diffplug.spotless" version "6.25.0"
id "io.freefair.lombok" version "8.4"
id "jacoco"
id "java-library"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,30 @@ public class ParserFunctionEvaluator extends BaseFunctionEvaluator {
public static Optional<String> evaluateFunction(
String functionName, List<Callable<String>> parameters) {
return switch (functionName) {
case DateAndTimeFunctionEvaluator.CURRENTMONTH -> Optional.of(
DateAndTimeFunctionEvaluator.currentMonth());
case ExtensionParserFunctionEvaluator.EXPRESSION -> Optional.of(
ExtensionParserFunctionEvaluator.expr(parameters));
case ExtensionParserFunctionEvaluator.IF -> Optional.of(
ExtensionParserFunctionEvaluator.ifFunction(parameters));
case ExtensionParserFunctionEvaluator.IF_EQ -> Optional.of(
ExtensionParserFunctionEvaluator.ifEq(parameters));
case ExtensionParserFunctionEvaluator.IF_EXPRESSION -> Optional.of(
ExtensionParserFunctionEvaluator.ifExpression(parameters));
case ExtensionParserFunctionEvaluator.IF_ERROR -> Optional.of(
ExtensionParserFunctionEvaluator.ifError(parameters));
case ExtensionParserFunctionEvaluator.SWITCH -> Optional.of(
ExtensionParserFunctionEvaluator.switchExpression(parameters));
case PathFunctionEvaluator.ANCHOR_ENCODE -> Optional.of(
PathFunctionEvaluator.anchorEncode(visitAllParameters(parameters)));
case PathFunctionEvaluator.CANONICAL_URL -> Optional.of(
PathFunctionEvaluator.canonicalUrl(visitAllParameters(parameters)));
case PathFunctionEvaluator.LOCAL_URL -> Optional.of(
PathFunctionEvaluator.localUrl(visitAllParameters(parameters)));
case PathFunctionEvaluator.NAMESPACE -> PathFunctionEvaluator.namespaceTranslator(
visitAllParameters(parameters));
case PathFunctionEvaluator.URL_ENCODE -> Optional.of(
PathFunctionEvaluator.urlEncode(visitAllParameters(parameters)));
case DateAndTimeFunctionEvaluator.CURRENTMONTH ->
Optional.of(DateAndTimeFunctionEvaluator.currentMonth());
case ExtensionParserFunctionEvaluator.EXPRESSION ->
Optional.of(ExtensionParserFunctionEvaluator.expr(parameters));
case ExtensionParserFunctionEvaluator.IF ->
Optional.of(ExtensionParserFunctionEvaluator.ifFunction(parameters));
case ExtensionParserFunctionEvaluator.IF_EQ ->
Optional.of(ExtensionParserFunctionEvaluator.ifEq(parameters));
case ExtensionParserFunctionEvaluator.IF_EXPRESSION ->
Optional.of(ExtensionParserFunctionEvaluator.ifExpression(parameters));
case ExtensionParserFunctionEvaluator.IF_ERROR ->
Optional.of(ExtensionParserFunctionEvaluator.ifError(parameters));
case ExtensionParserFunctionEvaluator.SWITCH ->
Optional.of(ExtensionParserFunctionEvaluator.switchExpression(parameters));
case PathFunctionEvaluator.ANCHOR_ENCODE ->
Optional.of(PathFunctionEvaluator.anchorEncode(visitAllParameters(parameters)));
case PathFunctionEvaluator.CANONICAL_URL ->
Optional.of(PathFunctionEvaluator.canonicalUrl(visitAllParameters(parameters)));
case PathFunctionEvaluator.LOCAL_URL ->
Optional.of(PathFunctionEvaluator.localUrl(visitAllParameters(parameters)));
case PathFunctionEvaluator.NAMESPACE ->
PathFunctionEvaluator.namespaceTranslator(visitAllParameters(parameters));
case PathFunctionEvaluator.URL_ENCODE ->
Optional.of(PathFunctionEvaluator.urlEncode(visitAllParameters(parameters)));
case INVOKE -> Optional.of(invoke(visitAllParameters(parameters)));
case LOWERCASE_FUNCTION -> Optional.of(lowercase(visitAllParameters(parameters)));
case PLURAL_FUNCTION -> Optional.of(plural(visitAllParameters(parameters)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ public static String urlEncode(List<String> parameters) {
case "path" -> encoded.replace("+", "%20");
case "query" -> encoded;
case "wiki" -> encoded.replace("+", "_");
default -> throw new IllegalArgumentException(
String.format(
"Unsupported urlencode type %s, supported options: PATH, QUERY, WIKI", spaceFlag));
default ->
throw new IllegalArgumentException(
String.format(
"Unsupported urlencode type %s, supported options: PATH, QUERY, WIKI",
spaceFlag));
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,27 @@ public Optional<String> getTemplate(String template) {
return switch (template) {
case "Template:asof" -> makeTemplatePlaceholder("asof", List.of());
case "Template:authority control" -> makeTemplatePlaceholder("Authority control", List.of());
case "Template:being deleted" -> makeTemplatePlaceholder(
"Being deleted", List.of("1", "2", "merge"));
case "Template:being deleted" ->
makeTemplatePlaceholder("Being deleted", List.of("1", "2", "merge"));
case "Template:cite nie" -> makeTemplatePlaceholder("cite NIE", List.of("wstitle", "year"));
case "Template:cite web" -> makeTemplatePlaceholder(
"cite web", List.of("url", "title", "author", "work"));
case "Template:cite web" ->
makeTemplatePlaceholder("cite web", List.of("url", "title", "author", "work"));
case "Template:clarify" -> makeTemplatePlaceholder("clarify", List.of("text", "date"));
case "Template:law-term-stub" -> makeTemplatePlaceholder("Law-term-stub", List.of());
case "Template:MONTHNAME" -> Optional.of("Sep");
case "Template:more citations needed" -> makeTemplatePlaceholder(
"more citations needed", List.of("date"));
case "Template:more citations needed" ->
makeTemplatePlaceholder("more citations needed", List.of("date"));
case "Template:pagename" -> Optional.of("PAGENAME");
case "Template:reflist" -> makeTemplatePlaceholder("Reflist", List.of());
case "Template:short description" -> makeTemplatePlaceholder(
"Short description", List.of("1"));
case "Template:short description" ->
makeTemplatePlaceholder("Short description", List.of("1"));
case "Template:wiktionary" -> makeTemplatePlaceholder("wiktionary", List.of("1"));
default -> Optional.of(
String.format(
"%s",
Assertions.fail(
String.format("Not expecting template '%s' to be needed", template))));
default ->
Optional.of(
String.format(
"%s",
Assertions.fail(
String.format("Not expecting template '%s' to be needed", template))));
};
}
}
Loading