From 7fa9c07b5475f98eb19900dfcff09b965435ae5f Mon Sep 17 00:00:00 2001 From: Username404 Date: Wed, 9 Jun 2021 21:21:30 +0200 Subject: [PATCH] Add the spotless gradle plugin to use the diktat formatter --- Formatting.yml | 35 +++++++++++++++++++ build.gradle.kts | 11 ++++++ .../username404/snowygui/gui/feature/Macro.kt | 4 +++ 3 files changed, 50 insertions(+) create mode 100644 Formatting.yml diff --git a/Formatting.yml b/Formatting.yml new file mode 100644 index 0000000..9a59d82 --- /dev/null +++ b/Formatting.yml @@ -0,0 +1,35 @@ +- name: HEADER_MISSING_OR_WRONG_COPYRIGHT + enabled: false + +- name: COMMENTED_OUT_CODE + enabled: true + +- name: SAY_NO_TO_VAR + enabled: true + +- name: UNUSED_IMPORT + enabled: true + +- name: CUSTOM_GETTERS_SETTERS + enabled: false + +- name: WRONG_INDENTATION + enabled: true + +- name: TYPEALIAS_NAME_INCORRECT_CASE + enabled: false + +- name: FUNCTION_NAME_INCORRECT_CASE + enabled: false + +- name: CONSTANT_UPPERCASE + enabled: false + +- name: MISSING_KDOC_TOP_LEVEL + enabled: false + +- name: MISSING_KDOC_CLASS_ELEMENTS + enabled: false + +- name: MISSING_KDOC_ON_FUNCTION + enabled: false \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 52c97b5..70a17b0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,6 +17,7 @@ plugins { id("dev.architectury.loom") version "0.7.2.110" apply false id("com.github.ben-manes.versions") version "0.39.0" id("net.kyori.indra.git") version "2.0.5" + id("com.diffplug.spotless") version "5.12.5" id("com.modrinth.minotaur") version "1.2.1" } @@ -161,6 +162,16 @@ allprojects { **/ apply(plugin = "java") apply(plugin = "org.jetbrains.kotlin.jvm") + apply(plugin = "com.diffplug.spotless") + spotless { + encoding = Charsets.UTF_8 + kotlin { + ignoreErrorForStep("diktat") + diktat("0.6.1").configFile("$rootDir/Formatting.yml") + trimTrailingWhitespace(); endWithNewline() + } + } + tasks.spotlessCheck.get().finalizedBy(tasks.spotlessApply) apply(plugin = "architectury-plugin") val compiler = javaToolchains.compilerFor { languageVersion.set(JavaLanguageVersion.of(sourceJavaVer.toInt())) } dependencies { diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/Macro.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/Macro.kt index 46081c7..fb1b7c0 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/Macro.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/Macro.kt @@ -4,6 +4,10 @@ import fr.username404.snowygui.gui.feature.ButtonInfo.Companion.Type import kotlinx.serialization.Serializable import net.minecraft.client.Minecraft +/** + * @property command The command to execute + * @property title The title of the macro + */ @Serializable @ButtonInfo.Ignored @ButtonInfo(Category.MACROS, kind = Type.CLICK)