From 62f0ad7127e70a71551b24de60de27662d3220a3 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 21 Dec 2024 22:56:43 +0100 Subject: [PATCH 1/7] better formatting settings --- .editorconfig | 7 +++++++ detekt/detekt.yml | 9 +++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.editorconfig b/.editorconfig index d781e8ef4800..54e4945de5a2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -25,6 +25,7 @@ ij_java_names_count_to_use_import_on_demand = 2147483647 ij_java_class_count_to_use_import_on_demand = 2147483647 ij_java_packages_to_use_import_on_demand = 2147483647 +# Kotlin Files [*.kt] ktlint_code_style = intellij_idea @@ -59,3 +60,9 @@ ktlint_standard_final-newline = disabled ktlint_standard_no-wildcard-imports = enabled ktlint_standard_function-expression-body = disabled + +# Additional Kotlin-specific formatting for conditions and continuation +ij_kotlin_continuation_indent_size = 8 +ij_kotlin_binary_expression_wrap = if_long +ij_kotlin_keep_line_breaks = true +ij_kotlin_annotations_new_line_after_suppress = true diff --git a/detekt/detekt.yml b/detekt/detekt.yml index 038f970410ab..213ba53e849f 100644 --- a/detekt/detekt.yml +++ b/detekt/detekt.yml @@ -1,4 +1,3 @@ - config: validation: true @@ -24,7 +23,6 @@ ImportRules: CustomImportOrdering: active: true - style: MagicNumber: # I, Linnea Gräf, of sound mind and body, disagree with disabling this rule active: false @@ -87,8 +85,11 @@ formatting: active: false ImportOrdering: # handled by custom rule active: false - AnnotationSpacing: # handled by custom rule - active: false + AnnotationSpacing: # enabled to ensure proper annotation placement + active: true + includeAnnotations: ["Suppress"] # Only enforce for @Suppress + excludeAnnotations: [] # Do not exclude any other annotations + newLineBeforeAnnotation: true # Place annotation on its own line complexity: CyclomaticComplexMethod: # default threshold of 15, caught almost every complex method From 3fd19a1aabb1c947bee774a02087588977d1d2f7 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 21 Dec 2024 23:12:02 +0100 Subject: [PATCH 2/7] detekt --- src/main/java/at/hannibal2/skyhanni/data/BossbarData.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/BossbarData.kt b/src/main/java/at/hannibal2/skyhanni/data/BossbarData.kt index 288c3cf50932..699a40bd57c8 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/BossbarData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/BossbarData.kt @@ -1,12 +1,13 @@ package at.hannibal2.skyhanni.data +//#if MC < 1.12 import at.hannibal2.skyhanni.events.BossbarUpdateEvent +import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -//#if MC < 1.12 -import at.hannibal2.skyhanni.events.LorenzTickEvent import net.minecraft.entity.boss.BossStatus +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + //#else //$$ import net.minecraftforge.client.event.RenderGameOverlayEvent //#endif @@ -25,8 +26,8 @@ object BossbarData { bossbar = null } - @SubscribeEvent //#if MC < 1.12 + @SubscribeEvent fun onTick(event: LorenzTickEvent) { val bossbarLine = BossStatus.bossName ?: return //#else From 48a8abc1d675a567be0046bb5d436ea73b61684c Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 22 Dec 2024 00:34:03 +0100 Subject: [PATCH 3/7] fixed build --- src/main/java/at/hannibal2/skyhanni/data/BossbarData.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/at/hannibal2/skyhanni/data/BossbarData.kt b/src/main/java/at/hannibal2/skyhanni/data/BossbarData.kt index 699a40bd57c8..75e8641bd72b 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/BossbarData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/BossbarData.kt @@ -31,6 +31,7 @@ object BossbarData { fun onTick(event: LorenzTickEvent) { val bossbarLine = BossStatus.bossName ?: return //#else + //$$ @SubscribeEvent //$$ fun onRenderGameOverlay(event: RenderGameOverlayEvent.BossInfo) { //$$ val bossbarLine = event.bossInfo.name.formattedText //#endif From 5e831720d3bcd6ad4bd29b35b76ce345db6a694a Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 22 Dec 2024 00:35:21 +0100 Subject: [PATCH 4/7] now correctly prevents the sending of mining event data to the server when the mining event display is disabled. --- .../features/itemabilities/abilitycooldown/ItemAbility.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt index 92e0cefff0f7..7e15a02adf86 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt @@ -44,7 +44,7 @@ enum class ItemAbility( WEIRDER_TUBA(30), FIRE_FREEZE_STAFF(10), SWORD_OF_BAD_HEALTH(5), - WITHER_CLOAK(10), + WITHER_CLOAK(10, ignoreMageCooldownReduction = true), HOLY_ICE(4), VOODOO_DOLL_WILTED(3), FIRE_FURY_STAFF(20), From f1b23caed552286beeda6750851f7c35ec1a5c31 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 22 Dec 2024 00:36:30 +0100 Subject: [PATCH 5/7] fixed build v2 --- src/main/java/at/hannibal2/skyhanni/data/BossbarData.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/BossbarData.kt b/src/main/java/at/hannibal2/skyhanni/data/BossbarData.kt index 75e8641bd72b..b59d5f49fbc8 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/BossbarData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/BossbarData.kt @@ -1,13 +1,12 @@ package at.hannibal2.skyhanni.data -//#if MC < 1.12 import at.hannibal2.skyhanni.events.BossbarUpdateEvent -import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule -import net.minecraft.entity.boss.BossStatus import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - +//#if MC < 1.12 +import at.hannibal2.skyhanni.events.LorenzTickEvent +import net.minecraft.entity.boss.BossStatus //#else //$$ import net.minecraftforge.client.event.RenderGameOverlayEvent //#endif From 60383818f5f73c46cc4c9260c461e2d3e7885d66 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 22 Dec 2024 00:36:56 +0100 Subject: [PATCH 6/7] revert unrelated changes --- .../features/itemabilities/abilitycooldown/ItemAbility.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt index 7e15a02adf86..92e0cefff0f7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt @@ -44,7 +44,7 @@ enum class ItemAbility( WEIRDER_TUBA(30), FIRE_FREEZE_STAFF(10), SWORD_OF_BAD_HEALTH(5), - WITHER_CLOAK(10, ignoreMageCooldownReduction = true), + WITHER_CLOAK(10), HOLY_ICE(4), VOODOO_DOLL_WILTED(3), FIRE_FURY_STAFF(20), From d204408db44bbc0f39e76484468a5f9693697e38 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 22 Dec 2024 01:16:22 +0100 Subject: [PATCH 7/7] we do not allow comments below annotations --- detekt/detekt.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/detekt/detekt.yml b/detekt/detekt.yml index 213ba53e849f..374d87e691bd 100644 --- a/detekt/detekt.yml +++ b/detekt/detekt.yml @@ -85,11 +85,8 @@ formatting: active: false ImportOrdering: # handled by custom rule active: false - AnnotationSpacing: # enabled to ensure proper annotation placement - active: true - includeAnnotations: ["Suppress"] # Only enforce for @Suppress - excludeAnnotations: [] # Do not exclude any other annotations - newLineBeforeAnnotation: true # Place annotation on its own line + AnnotationSpacing: # handled by custom rule + active: false complexity: CyclomaticComplexMethod: # default threshold of 15, caught almost every complex method