Skip to content
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

Backend: Detekt Fixes Part 5 #2617

Merged
merged 16 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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
55 changes: 30 additions & 25 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import at.skyhanni.sharedvariables.versionString
import net.fabricmc.loom.task.RunGameTask
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask

plugins {
idea
Expand Down Expand Up @@ -344,28 +346,31 @@ publishing.publications {
}
}

// Detekt: TODO: Uncomment this when we're ready to enforce
// detekt {
// buildUponDefaultConfig = true // preconfigure defaults
// config.setFrom(rootProject.layout.projectDirectory.file("detekt/detekt.yml")) // point to your custom config defining rules to run, overwriting default behavior
// baseline = file(layout.projectDirectory.file("detekt/baseline.xml")) // a way of suppressing issues before introducing detekt
// source.setFrom(project.sourceSets.named("main").map { it.allSource })
// }
//
// tasks.withType<Detekt>().configureEach {
// reports {
// html.required.set(true) // observe findings in your browser with structure and code snippets
// xml.required.set(true) // checkstyle like format mainly for integrations like Jenkins
// sarif.required.set(true) // standardized SARIF format (https://sarifweb.azurewebsites.net/) to support integrations with GitHub Code Scanning
// md.required.set(true) // simple Markdown format
// }
// }
//
// tasks.withType<Detekt>().configureEach {
// jvmTarget = target.minecraftVersion.formattedJavaLanguageVersion
// outputs.cacheIf { false } // Custom rules won't work if cached
// }
// tasks.withType<DetektCreateBaselineTask>().configureEach {
// jvmTarget = target.minecraftVersion.formattedJavaLanguageVersion
// outputs.cacheIf { false } // Custom rules won't work if cached
// }
detekt {
buildUponDefaultConfig = true // preconfigure defaults
config.setFrom(rootProject.layout.projectDirectory.file("detekt/detekt.yml")) // point to your custom config defining rules to run, overwriting default behavior
baseline = file(layout.projectDirectory.file("detekt/baseline.xml")) // a way of suppressing issues before introducing detekt
source.setFrom(project.sourceSets.named("main").map { it.allSource })
}

tasks.withType<Detekt>().configureEach {
onlyIf {
false // TODO: Remove onlyIf when we're ready to enforce
}

reports {
html.required.set(true) // observe findings in your browser with structure and code snippets
xml.required.set(true) // checkstyle like format mainly for integrations like Jenkins
sarif.required.set(true) // standardized SARIF format (https://sarifweb.azurewebsites.net/) to support integrations with GitHub Code Scanning
md.required.set(true) // simple Markdown format
}
}

tasks.withType<Detekt>().configureEach {
jvmTarget = target.minecraftVersion.formattedJavaLanguageVersion
outputs.cacheIf { false } // Custom rules won't work if cached
}
tasks.withType<DetektCreateBaselineTask>().configureEach {
jvmTarget = target.minecraftVersion.formattedJavaLanguageVersion
outputs.cacheIf { false } // Custom rules won't work if cached
}
2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/api/GetFromSackAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ object GetFromSackAPI {
if (!amountString.isDouble()) return CommandResult.WRONG_AMOUNT to null

val itemString = arguments.dropLast(1).joinToString(" ").uppercase().replace(':', '-')
val replacedString = itemString.replace("_"," ")
val replacedString = itemString.replace("_", " ")

val item = when {
SackAPI.sackListInternalNames.contains(itemString) -> itemString.asInternalName()
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/at/hannibal2/skyhanni/data/HotmData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,8 @@ enum class HotmData(

val storage get() = ProfileStorageData.profileSpecific?.mining?.hotmTree

val abilities = listOf(PICKOBULUS, MINING_SPEED_BOOST, MANIAC_MINER, GEMSTONE_INFUSION, ANOMALOUS_DESIRE, SHEER_FORCE)
val abilities =
listOf(PICKOBULUS, MINING_SPEED_BOOST, MANIAC_MINER, GEMSTONE_INFUSION, ANOMALOUS_DESIRE, SHEER_FORCE)

private val inventoryPattern by patternGroup.pattern(
"inventory",
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -412,5 +412,5 @@ enum class SackStatus {
MISSING,
CORRECT,
ALRIGHT,
OUTDATED;
OUTDATED,
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ object MobDetection {
MobData.currentEntityLiving.clear() // Naturally removing the mobs using the despawn
}

(MobData.currentEntityLiving - MobData.previousEntityLiving).forEach { addRetry(it) } // Spawn
(MobData.currentEntityLiving - MobData.previousEntityLiving).forEach { addRetry(it) } // Spawn
(MobData.previousEntityLiving - MobData.currentEntityLiving).forEach { entityDeSpawn(it) } // Despawn

MobData.notSeenMobs.removeIf(::canBeSeen)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ package at.hannibal2.skyhanni.features.bingo.card.goals
enum class GoalType {
COMMUNITY,
PERSONAL,
;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object ColorFormattingHelper {
"§f&k = Obfuscated (like this: §khellspawn§r)\n" +
"§f&l = §lBold §r&m = §mStrikethrough \n" +
"§f&o = §oItalic §r&n = §nUnderline\n" +
"§f&r = Reset\n"+
"§f&r = Reset\n" +
"§c==================================================="
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ object PowderMiningChatFilter {
return null
}

private var rewardPatterns: Map<Pair<Pattern, PowderMiningFilterConfig.SimplePowderMiningRewardTypes>, String> = emptyMap()
private var rewardPatterns: Map<Pair<Pattern, PowderMiningFilterConfig.SimplePowderMiningRewardTypes>, String> =
emptyMap()

@SubscribeEvent(priority = EventPriority.HIGHEST)
fun onRepoReload(event: RepositoryReloadEvent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ enum class BossType(
NETHER_VANQUISHER("§5Vanquisher", Type.VANQUISHER),

END_ENDSTONE_PROTECTOR("§cEndstone Protector", Type.ENDERSTONE_PROTECTOR),
END_ENDER_DRAGON("Ender Dragon", Type.ENDER_DRAGON),// TODO fix totally
END_ENDER_DRAGON("Ender Dragon", Type.ENDER_DRAGON), // TODO fix totally

SLAYER_ZOMBIE_1("§aRevenant Horror 1", Type.REVENANT_HORROR, "§aRev 1", showDeathTime = true),
SLAYER_ZOMBIE_2("§eRevenant Horror 2", Type.REVENANT_HORROR, "§eRev 2", showDeathTime = true),
Expand Down Expand Up @@ -107,7 +107,7 @@ enum class BossType(
LEECH_SUPREME("§cLeech Supreme", Type.THE_RIFT_BOSSES),
BACTE("§aBacte", Type.THE_RIFT_BOSSES),

WINTER_REINDRAKE("Reindrake", Type.REINDRAKE),// TODO fix totally
WINTER_REINDRAKE("Reindrake", Type.REINDRAKE), // TODO fix totally

GARDEN_PEST_BEETLE("§cBeetle", Type.GARDEN_PESTS),
GARDEN_PEST_CRICKET("§cCricket", Type.GARDEN_PESTS),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ object GhostCounter {
val config get() = SkyHanniMod.feature.combat.ghostCounter
val storage get() = ProfileStorageData.profileSpecific?.ghostCounter
private var display = emptyList<List<Any>>()
var ghostCounterV3File = File(FilenameUtils.separatorsToSystem("./config/ChatTriggers/modules/GhostCounterV3/.persistantData.json"))
var ghostCounterV3File =
File(FilenameUtils.separatorsToSystem("./config/ChatTriggers/modules/GhostCounterV3/.persistantData.json"))

private val patternGroup = RepoPattern.group("combat.ghostcounter")
private val skillXPPattern by patternGroup.pattern(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ object MobHighlight {
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(
entity,
LorenzColor.DARK_PURPLE.toColor().withAlpha(127)
)
{ config.corruptedMobHighlight }
) { config.corruptedMobHighlight }
}
}

Expand All @@ -57,16 +56,14 @@ object MobHighlight {
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(
entity,
LorenzColor.DARK_BLUE.toColor().withAlpha(127)
)
{ config.arachneKeeperHighlight }
) { config.arachneKeeperHighlight }
}

if (config.corleoneHighlighter && maxHealth == 1_000_000 && entity is EntityOtherPlayerMP && entity.name == "Team Treasurite") {
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(
entity,
LorenzColor.DARK_PURPLE.toColor().withAlpha(127)
)
{ config.corleoneHighlighter }
) { config.corleoneHighlighter }
}

if (entity is EntityEnderman) {
Expand All @@ -78,8 +75,7 @@ object MobHighlight {
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(
entity,
LorenzColor.DARK_AQUA.toColor().withAlpha(127)
)
{ config.zealotBruiserHighlighter }
) { config.zealotBruiserHighlighter }
}
}

Expand All @@ -89,8 +85,7 @@ object MobHighlight {
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(
entity,
LorenzColor.GREEN.toColor().withAlpha(127)
)
{ config.chestZealotHighlighter }
) { config.chestZealotHighlighter }
}
}

Expand All @@ -99,8 +94,7 @@ object MobHighlight {
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(
entity,
LorenzColor.DARK_RED.toColor().withAlpha(50)
)
{ config.specialZealotHighlighter }
) { config.specialZealotHighlighter }
}
}

Expand Down Expand Up @@ -153,12 +147,16 @@ object MobHighlight {
}

private fun markArachneMinis(entity: EntityLivingBase) {
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(entity, LorenzColor.GOLD.toColor().withAlpha(50))
{ config.arachneBossHighlighter }
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(
entity,
LorenzColor.GOLD.toColor().withAlpha(50)
) { config.arachneBossHighlighter }
}

private fun markArachne(entity: EntityLivingBase) {
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(entity, LorenzColor.RED.toColor().withAlpha(50))
{ config.arachneBossHighlighter }
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(
entity,
LorenzColor.RED.toColor().withAlpha(50)
) { config.arachneBossHighlighter }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ object DungeonHideItems {

if (isSkeletonSkull(entity)) {
movingSkeletonSkulls[entity] = System.currentTimeMillis()
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(entity, LorenzColor.GOLD.toColor().withAlpha(60))
{
shouldColorMovingSkull(entity)
}
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(
entity,
LorenzColor.GOLD.toColor().withAlpha(60)
) { shouldColorMovingSkull(entity) }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ object HighlightDungeonDeathmite {
val maxHealth = event.maxHealth

if (entity is EntitySilverfish && maxHealth == 1_000_000_000) {
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(entity, LorenzColor.DARK_RED.toColor().withAlpha(20))
{ SkyHanniMod.feature.dungeon.highlightDeathmites }
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(
entity,
LorenzColor.DARK_RED.toColor().withAlpha(20)
) { SkyHanniMod.feature.dungeon.highlightDeathmites }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ object HoppityCollectionStats {
val newItemStack = if (config.rarityDyeRecolor) ItemStack(
Items.dye, 1,
when (rarity) {
LorenzRarity.COMMON -> 7 // Light gray dye
LorenzRarity.COMMON -> 7 // Light gray dye
LorenzRarity.UNCOMMON -> 10 // Lime dye
LorenzRarity.RARE -> 4 // Lapis lazuli
LorenzRarity.EPIC -> 5 // Purple dye
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.now
import at.hannibal2.skyhanni.utils.SkyBlockTime
import at.hannibal2.skyhanni.utils.SoundUtils
import at.hannibal2.skyhanni.utils.TimeUtils.format
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.regex.Matcher
import kotlin.time.Duration.Companion.minutes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ object HoppityNpc {
actionName = "warp to hub",
action = {
HypixelCommands.warp("hub")
//afterNextIslandwarpTtp hub: IslandGraphs.pathFind(hoppity)
// afterNextIslandwarpTtp hub: IslandGraphs.pathFind(hoppity)
},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ object FrozenTreasureTracker {
private var icePerSecond = mutableListOf<Long>()
private var icePerHour = 0
private var stoppedChecks = 0
private val tracker = SkyHanniTracker("Frozen Treasure Tracker", { Data() }, { it.frozenTreasureTracker })
{ formatDisplay(drawDisplay(it)) }
private val tracker = SkyHanniTracker("Frozen Treasure Tracker", { Data() }, { it.frozenTreasureTracker }) {
formatDisplay(drawDisplay(it))
}

init {
FrozenTreasure.entries.forEach { it.chatPattern }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ object EasterEggWaypoints {
/*
Title:
§e§lHYPIXEL

'§703/14/24 §8L30A'
' '
'Rank: §bMVP§d+§b'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ object SeaCreatureTracker {

private val config get() = SkyHanniMod.feature.fishing.seaCreatureTracker

private val tracker = SkyHanniTracker("Sea Creature Tracker", { Data() }, { it.fishing.seaCreatureTracker })
{ drawDisplay(it) }
private val tracker = SkyHanniTracker("Sea Creature Tracker", { Data() }, { it.fishing.seaCreatureTracker }) {
drawDisplay(it)
}

class Data : TrackerData() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ object AnitaMedalProfit {
GOLD("§6Gold medal", 8),
SILVER("§fSilver medal", 2),
BRONZE("§cBronze medal", 1),
;
}

private fun getMedal(name: String) = MedalType.entries.firstOrNull { it.displayName == name }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ object ArmorDropTracker {

private var hasArmor = false

private val tracker = SkyHanniTracker("Armor Drop Tracker", { Data() }, { it.garden.armorDropTracker })
{ drawDisplay(it) }
private val tracker = SkyHanniTracker("Armor Drop Tracker", { Data() }, { it.garden.armorDropTracker }) {
drawDisplay(it)
}

class Data : TrackerData() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ object DicerRngDropTracker {

private val itemDrops = mutableListOf<ItemDrop>()
private val config get() = GardenAPI.config.dicerCounters
private val tracker = SkyHanniTracker("Dicer RNG Drop Tracker", { Data() }, { it.garden.dicerDropTracker })
{ drawDisplay(it) }
private val tracker = SkyHanniTracker("Dicer RNG Drop Tracker", { Data() }, { it.garden.dicerDropTracker }) {
drawDisplay(it)
}

class Data : TrackerData() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ package at.hannibal2.skyhanni.features.garden.farming.lane
enum class FarmingDirection {
NORTH_SOUTH,
EAST_WEST,
;
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ object FarmingLaneFeatures {
TOO_SLOW("§cToo slow!"),
CALCULATING("§aCalculating.."),
NORMAL(""),
;
}

@HandleEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ object GardenVisitorCompactChat {
)

private var visitorAcceptedChat = mutableListOf<String>()
private var visitorNameFormatted = "";
private var visitorNameFormatted = ""
private var rewardsList = mutableListOf<String>()

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ object GardenVisitorDropStatistics {

for (reward in VisitorReward.entries) {
val count = rewardsCount[reward] ?: 0
if (config.displayIcons) {// Icons
if (config.displayIcons) { // Icons
val stack = reward.itemStack
if (config.displayNumbersFirst)
add(listOf("§b${count.addSeparators()} ", stack))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ object VisitorAPI {
val pricePerCopper = pricePerCopper ?: error("pricePerCopper is null")
val totalPrice = totalPrice ?: error("totalPrice is null")
val totalReward = totalReward ?: error("totalReward is null")
val loss = totalPrice - totalReward;
val loss = totalPrice - totalReward
return when {
preventRefusing && hasReward() != null -> VisitorBlockReason.RARE_REWARD
preventRefusingNew && offersAccepted == 0 -> VisitorBlockReason.NEVER_ACCEPTED
Expand Down
Loading
Loading