Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -318,27 +318,18 @@ private Optional<String> getTagContent(Subcommand subcommand, String id) {
* @param event the event to send messages with
* @return whether the status of the given tag is <b>not equal</b> to the required status
*/
// ToDo: gradle task :application:spotlessJava throws internal exception if this method uses new
// when keyword
@SuppressWarnings("java:S6916")
private boolean isWrongTagStatusAndHandle(TagStatus requiredTagStatus, String id,
IReplyCallback event) {
switch (requiredTagStatus) {
case TagStatus.EXISTS -> {
return tagSystem.handleIsUnknownTag(id, event);
}
case TagStatus.NOT_EXISTS -> {
if (tagSystem.hasTag(id)) {
event.reply("The tag with id '%s' already exists.".formatted(id))
.setEphemeral(true)
.queue();
return true;
}
return switch (requiredTagStatus) {
case TagStatus.EXISTS -> tagSystem.handleIsUnknownTag(id, event);
case TagStatus status when status == TagStatus.NOT_EXISTS && tagSystem.hasTag(id) -> {
event.reply("The tag with id '%s' already exists.".formatted(id))
.setEphemeral(true)
.queue();
yield true;
}
default ->
throw new AssertionError("Unknown tag status '%s'".formatted(requiredTagStatus));
}
return false;
case TagStatus.NOT_EXISTS -> false;
};
}

private void logAction(Subcommand subcommand, Guild guild, User author,
Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ subprojects {
// we use it as catch-all for external dependencies like JDA
// '\\#` is prefix for static imports
importOrder('','org.togetherjava', 'javax', 'java', '\\#')
eclipse().configFile("${rootProject.rootDir}/meta/formatting/google-style-eclipse.xml")
// TODO: pinning version because of spotless error https://github.com/diffplug/spotless/issues/1992
eclipse("4.31").configFile("${rootProject.rootDir}/meta/formatting/google-style-eclipse.xml")
}
}

Expand Down