Skip to content

Commit 9122c16

Browse files
authored
fix spotless error by pinning the version (#1122)
* fix spotless error by pinning the version * added default branch * added comment * remove default
1 parent 94eefff commit 9122c16

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

application/src/main/java/org/togetherjava/tjbot/features/tags/TagManageCommand.java

+9-18
Original file line numberDiff line numberDiff line change
@@ -318,27 +318,18 @@ private Optional<String> getTagContent(Subcommand subcommand, String id) {
318318
* @param event the event to send messages with
319319
* @return whether the status of the given tag is <b>not equal</b> to the required status
320320
*/
321-
// ToDo: gradle task :application:spotlessJava throws internal exception if this method uses new
322-
// when keyword
323-
@SuppressWarnings("java:S6916")
324321
private boolean isWrongTagStatusAndHandle(TagStatus requiredTagStatus, String id,
325322
IReplyCallback event) {
326-
switch (requiredTagStatus) {
327-
case TagStatus.EXISTS -> {
328-
return tagSystem.handleIsUnknownTag(id, event);
329-
}
330-
case TagStatus.NOT_EXISTS -> {
331-
if (tagSystem.hasTag(id)) {
332-
event.reply("The tag with id '%s' already exists.".formatted(id))
333-
.setEphemeral(true)
334-
.queue();
335-
return true;
336-
}
323+
return switch (requiredTagStatus) {
324+
case TagStatus.EXISTS -> tagSystem.handleIsUnknownTag(id, event);
325+
case TagStatus status when status == TagStatus.NOT_EXISTS && tagSystem.hasTag(id) -> {
326+
event.reply("The tag with id '%s' already exists.".formatted(id))
327+
.setEphemeral(true)
328+
.queue();
329+
yield true;
337330
}
338-
default ->
339-
throw new AssertionError("Unknown tag status '%s'".formatted(requiredTagStatus));
340-
}
341-
return false;
331+
case TagStatus.NOT_EXISTS -> false;
332+
};
342333
}
343334

344335
private void logAction(Subcommand subcommand, Guild guild, User author,

build.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ subprojects {
7878
// we use it as catch-all for external dependencies like JDA
7979
// '\\#` is prefix for static imports
8080
importOrder('','org.togetherjava', 'javax', 'java', '\\#')
81-
eclipse().configFile("${rootProject.rootDir}/meta/formatting/google-style-eclipse.xml")
81+
// TODO: pinning version because of spotless error https://github.com/diffplug/spotless/issues/1992
82+
eclipse("4.31").configFile("${rootProject.rootDir}/meta/formatting/google-style-eclipse.xml")
8283
}
8384
}
8485

0 commit comments

Comments
 (0)