Skip to content

Commit

Permalink
fix spotless error by pinning the version (#1122)
Browse files Browse the repository at this point in the history
* fix spotless error by pinning the version

* added default branch

* added comment

* remove default
  • Loading branch information
Taz03 authored May 23, 2024
1 parent 94eefff commit 9122c16
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
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

0 comments on commit 9122c16

Please sign in to comment.