Skip to content

fix spotless error by pinning the version #1122

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

Merged
merged 4 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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,20 @@ 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;
default -> throw new IllegalStateException(
"Unknown tag status '%s'".formatted(requiredTagStatus));
};
}

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
Loading