From 092a29dd8b13c2b04b0b7c259446ab697201dd5e Mon Sep 17 00:00:00 2001 From: David Cole <40234707+DavidArthurCole@users.noreply.github.com> Date: Thu, 26 Sep 2024 03:56:44 -0400 Subject: Backend: Dekekt (#2547) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Linnea Gräf Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: Cal --- .github/actions/setup-normal-workspace/action.yml | 13 + .github/scripts/process_detekt_sarif.sh | 37 +++ .github/workflows/build.yml | 42 +-- .github/workflows/check-style.yaml.disabled | 16 - CONTRIBUTING.md | 5 + build.gradle.kts | 56 ++-- detekt/baseline.xml | 339 +++++++++++++++++++++ detekt/build.gradle.kts | 13 + detekt/detekt.yml | 127 ++++++++ .../main/kotlin/formatting/CustomCommentSpacing.kt | 51 ++++ .../kotlin/formatting/FormattingRuleSetProvider.kt | 17 ++ detekt/src/main/kotlin/grammar/AvoidColour.kt | 38 +++ .../main/kotlin/grammar/GrammarRuleSetProvider.kt | 17 ++ detekt/src/main/kotlin/root.kt | 1 + gradle/libs.versions.toml | 3 + root.gradle.kts | 21 ++ settings.gradle.kts | 1 + sharedVariables/src/MinecraftVersion.kt | 3 + .../skyhanni/events/RenderItemTooltipEvent.kt | 5 + .../skyhanni/events/RenderTooltipEvent.kt | 5 - .../SuperpairExperimentInformationDisplay.kt | 2 +- versions/1.8.9/detekt/baseline.xml | 339 +++++++++++++++++++++ 22 files changed, 1089 insertions(+), 62 deletions(-) create mode 100644 .github/actions/setup-normal-workspace/action.yml create mode 100644 .github/scripts/process_detekt_sarif.sh delete mode 100644 .github/workflows/check-style.yaml.disabled create mode 100644 detekt/baseline.xml create mode 100644 detekt/build.gradle.kts create mode 100644 detekt/detekt.yml create mode 100644 detekt/src/main/kotlin/formatting/CustomCommentSpacing.kt create mode 100644 detekt/src/main/kotlin/formatting/FormattingRuleSetProvider.kt create mode 100644 detekt/src/main/kotlin/grammar/AvoidColour.kt create mode 100644 detekt/src/main/kotlin/grammar/GrammarRuleSetProvider.kt create mode 100644 detekt/src/main/kotlin/root.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/events/RenderItemTooltipEvent.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/events/RenderTooltipEvent.kt create mode 100644 versions/1.8.9/detekt/baseline.xml diff --git a/.github/actions/setup-normal-workspace/action.yml b/.github/actions/setup-normal-workspace/action.yml new file mode 100644 index 000000000..a0781d53c --- /dev/null +++ b/.github/actions/setup-normal-workspace/action.yml @@ -0,0 +1,13 @@ +name: 'Setup Java, Gradle and check out the source code' + +runs: + using: composite + steps: + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 21 + cache: gradle + - name: Setup gradle + uses: gradle/actions/setup-gradle@v4 diff --git a/.github/scripts/process_detekt_sarif.sh b/.github/scripts/process_detekt_sarif.sh new file mode 100644 index 000000000..7fb4f7e4e --- /dev/null +++ b/.github/scripts/process_detekt_sarif.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# This script processes the Detekt SARIF file and outputs results in a format +# suitable for annotation in CI/CD systems. + +SARIF_FILE="$1" + +# Check if SARIF file exists +if [ ! -f "$SARIF_FILE" ]; then + echo "SARIF file not found: $SARIF_FILE" + exit 1 +fi + +# Define jq command to parse SARIF file +read -r -d '' jq_command <<'EOF' +.runs[].results[] | +{ + "full_path": .locations[].physicalLocation.artifactLocation.uri | sub("file://$(pwd)/"; ""), + "file_name": (.locations[].physicalLocation.artifactLocation.uri | split("/") | last), + "l": .locations[].physicalLocation, + "level": .level, + "message": .message.text, + "ruleId": .ruleId +} | +( + "::" + (.level) + + " file=" + (.full_path) + + ",line=" + (.l.region.startLine|tostring) + + ",title=" + (.ruleId) + + ",col=" + (.l.region.startColumn|tostring) + + ",endColumn=" + (.l.region.endColumn|tostring) + + "::" + (.message.text) +) +EOF + +# Run jq command to format the output +jq -r "$jq_command" < "$SARIF_FILE" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7c75f0eef..7e42909ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,15 +18,9 @@ jobs: runs-on: ubuntu-latest name: "Build and test" steps: - - uses: actions/checkout@v3 - - name: Set up JDK 21 - uses: actions/setup-java@v3 - with: - java-version: 21 - distribution: temurin - cache: gradle - - name: Setup gradle - uses: gradle/gradle-build-action@v2 + - name: Checkout code + uses: actions/checkout@v4 + - uses: ./.github/actions/setup-normal-workspace - name: Build with Gradle run: ./gradlew assemble -x test --stacktrace - uses: actions/upload-artifact@v3 @@ -42,19 +36,31 @@ jobs: with: name: "Test Results" path: versions/1.8.9/build/reports/tests/test/ + #detekt: + # name: Run detekt + # runs-on: ubuntu-latest + + # steps: + # - name: Checkout code + # uses: actions/checkout@v4 + # - uses: ./.github/actions/setup-normal-workspace + # - name: Run detekt + # run: | + # ./gradlew detekt --stacktrace + # - name: Annotate detekt failures + # if: ${{ !cancelled() }} + # run: | + # chmod +x .github/scripts/process_detekt_sarif.sh + # ./.github/scripts/process_detekt_sarif.sh versions/1.8.9/build/reports/detekt/detekt.sarif + + preprocess: runs-on: ubuntu-latest name: "Build multi version" steps: - - uses: actions/checkout@v3 - - name: Set up JDK 21 - uses: actions/setup-java@v3 - with: - java-version: 21 - distribution: temurin - cache: gradle - - name: Setup gradle - uses: gradle/gradle-build-action@v2 + - name: Checkout code + uses: actions/checkout@v4 + - uses: ./.github/actions/setup-normal-workspace - name: Enable preprocessor run: | mkdir -p .gradle diff --git a/.github/workflows/check-style.yaml.disabled b/.github/workflows/check-style.yaml.disabled deleted file mode 100644 index ff172208f..000000000 --- a/.github/workflows/check-style.yaml.disabled +++ /dev/null @@ -1,16 +0,0 @@ -name: check-style -on: - - pull_request -jobs: - ktlint: - name: Check Style - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - name: Checkout code - - name: ktlint - uses: ScaCap/action-ktlint@master - with: - github_token: ${{ secrets.github_token }} - reporter: github-pr-check diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fc0f2d5c4..d68b88f9f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -97,6 +97,11 @@ format like "- #821" to illustrate the dependency. - Follow the [Hypixel Rules](https://hypixel.net/rules). - Use the coding conventions for [Kotlin](https://kotlinlang.org/docs/coding-conventions.html) and [Java](https://www.oracle.com/java/technologies/javase/codeconventions-contents.html). +- **My build is failing due to `detekt`, what do I do?** + - `detekt` is our code quality tool. It checks for code smells and style issues. + - If you have a build failure stating `Analysis failed with ... weighted issues.`, you can check `versions/[target version]/build/reports/detekt/` for a comprehensive list of issues. + - **There are valid reasons to deviate from the norm** + - If you have such a case, either use `@Supress("rule_name")`, or re-build the `baseline.xml` file, using `./gradlew detektBaseline`. - Do not copy features from other mods. Exceptions: - Mods that are paid to use. - Mods that have reached their end of life. (Rip SBA, Dulkir and Soopy). diff --git a/build.gradle.kts b/build.gradle.kts index add2df4e7..b0e2af254 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,6 +3,8 @@ import at.skyhanni.sharedvariables.MultiVersionStage import at.skyhanni.sharedvariables.ProjectTarget import at.skyhanni.sharedvariables.SHVersionInfo import at.skyhanni.sharedvariables.versionString +import io.gitlab.arturbosch.detekt.Detekt +import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask import net.fabricmc.loom.task.RunGameTask import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -18,32 +20,12 @@ plugins { kotlin("plugin.power-assert") `maven-publish` id("moe.nea.shot") version "1.0.0" + id("io.gitlab.arturbosch.detekt") id("net.kyori.blossom") } val target = ProjectTarget.values().find { it.projectPath == project.path }!! -repositories { - mavenCentral() - mavenLocal() - maven("https://maven.minecraftforge.net") { - metadataSources { - artifact() // We love missing POMs - } - } - maven("https://repo.spongepowered.org/maven/") // mixin - maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1") // DevAuth - maven("https://jitpack.io") { // NotEnoughUpdates (compiled against) - content { - includeGroupByRegex("(com|io)\\.github\\..*") - } - } - maven("https://repo.nea.moe/releases") // libautoupdate - maven("https://maven.notenoughupdates.org/releases") // NotEnoughUpdates (dev env) - maven("https://repo.hypixel.net/repository/Hypixel/") // mod-api - maven("https://maven.teamresourceful.com/repository/thatgravyboat/") // DiscordIPC -} - // Toolchains: java { toolchain.languageVersion.set(target.minecraftVersion.javaLanguageVersion) @@ -178,10 +160,14 @@ dependencies { exclude(module = "unspecified") isTransitive = false } - testImplementation("org.junit.jupiter:junit-jupiter:5.10.0") + testImplementation("org.junit.jupiter:junit-jupiter:5.11.0") testImplementation("io.mockk:mockk:1.12.5") implementation("net.hypixel:mod-api:0.3.1") + + detektPlugins("org.notenoughupdates:detektrules:1.0.0") + detektPlugins(project(":detekt")) + detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.7") } afterEvaluate { @@ -350,3 +336,29 @@ 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().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().configureEach { + jvmTarget = target.minecraftVersion.formattedJavaLanguageVersion + outputs.cacheIf { false } // Custom rules won't work if cached +} +tasks.withType().configureEach { + jvmTarget = target.minecraftVersion.formattedJavaLanguageVersion + outputs.cacheIf { false } // Custom rules won't work if cached +}*/ diff --git a/detekt/baseline.xml b/detekt/baseline.xml new file mode 100644 index 000000000..ac35c2f6d --- /dev/null +++ b/detekt/baseline.xml @@ -0,0 +1,339 @@ + + + + + AnnotationOnSeparateLine:GraphEditor.kt$GraphEditor$@Suppress("MapGetWithNotNullAssertionOperator") node.neighbours.map { GraphingEdge( translation[node]!!, translation[it.key]!!, ) } + AnnotationOnSeparateLine:GraphEditor.kt$GraphEditor$@Suppress("MapGetWithNotNullAssertionOperator") nodes[indexedTable[otherNode.id]!!] + ArrayPrimitive:CropMoneyDisplay.kt$CropMoneyDisplay$Array<Double> + ArrayPrimitive:CropMoneyDisplay.kt$CropMoneyDisplay$arrayOf(npcPrice) + ArrayPrimitive:CropMoneyDisplay.kt$CropMoneyDisplay$arrayOf(sellOffer) + ArrayPrimitive:LorenzVec.kt$Array<Double> + ArrayPrimitive:LorenzVec.kt$LorenzVec$Array<Double> + ArrayPrimitive:LorenzVec.kt$LorenzVec$Array<Float> + ArrayPrimitive:LorenzVec.kt$LorenzVec$arrayOf(x, y, z) + ArrayPrimitive:LorenzVec.kt$LorenzVec$arrayOf(x.toFloat(), y.toFloat(), z.toFloat()) + CyclomaticComplexMethod:AdvancedPlayerList.kt$AdvancedPlayerList$fun newSorting(original: List<String>): List<String> + CyclomaticComplexMethod:CropMoneyDisplay.kt$CropMoneyDisplay$private fun calculateMoneyPerHour(debugList: MutableList<List<Any>>): Map<NEUInternalName, Array<Double>> + CyclomaticComplexMethod:CropMoneyDisplay.kt$CropMoneyDisplay$private fun drawDisplay(): List<List<Any>> + CyclomaticComplexMethod:DamageIndicatorManager.kt$DamageIndicatorManager$private fun checkThorn(realHealth: Long, realMaxHealth: Long): String? + CyclomaticComplexMethod:EstimatedItemValueCalculator.kt$EstimatedItemValueCalculator$private fun addEnchantments(stack: ItemStack, list: MutableList<String>): Double + CyclomaticComplexMethod:GardenBestCropTime.kt$GardenBestCropTime$fun drawBestDisplay(currentCrop: CropType?): List<List<Any>> + CyclomaticComplexMethod:GardenCropMilestoneDisplay.kt$GardenCropMilestoneDisplay$private fun drawProgressDisplay(crop: CropType): List<Renderable> + CyclomaticComplexMethod:GardenVisitorFeatures.kt$GardenVisitorFeatures$private fun readToolTip(visitor: VisitorAPI.Visitor, itemStack: ItemStack?, toolTip: MutableList<String>) + CyclomaticComplexMethod:GhostCounter.kt$GhostCounter$private fun drawDisplay() + CyclomaticComplexMethod:GraphEditor.kt$GraphEditor$private fun input() + CyclomaticComplexMethod:GraphEditorBugFinder.kt$GraphEditorBugFinder$private fun asyncTest() + CyclomaticComplexMethod:IslandAreas.kt$IslandAreas$private fun buildDisplay() + CyclomaticComplexMethod:ItemDisplayOverlayFeatures.kt$ItemDisplayOverlayFeatures$private fun getStackTip(item: ItemStack): String? + CyclomaticComplexMethod:ItemNameResolver.kt$ItemNameResolver$internal fun getInternalNameOrNull(itemName: String): NEUInternalName? + CyclomaticComplexMethod:MinecraftConsoleFilter.kt$MinecraftConsoleFilter$override fun filter(event: LogEvent?): Filter.Result + CyclomaticComplexMethod:OverviewPage.kt$OverviewPage$private fun getPage(): Pair<List<List<Renderable>>, List<Renderable>> + CyclomaticComplexMethod:PacketTest.kt$PacketTest$private fun Packet<*>.print() + CyclomaticComplexMethod:ParkourHelper.kt$ParkourHelper$fun render(event: LorenzRenderWorldEvent) + CyclomaticComplexMethod:Renderable.kt$Renderable.Companion$internal fun shouldAllowLink(debug: Boolean = false, bypassChecks: Boolean): Boolean + CyclomaticComplexMethod:SkillProgress.kt$SkillProgress$private fun drawDisplay() + CyclomaticComplexMethod:VampireSlayerFeatures.kt$VampireSlayerFeatures$private fun EntityOtherPlayerMP.process() + CyclomaticComplexMethod:VisualWordGui.kt$VisualWordGui$override fun drawScreen(unusedX: Int, unusedY: Int, partialTicks: Float) + DestructuringDeclarationWithTooManyEntries:SackDisplay.kt$SackDisplay$val (internalName, rough, flawed, fine, roughPrice, flawedPrice, finePrice) = gem + Filename:AreaChangeEvents.kt$at.hannibal2.skyhanni.events.skyblock.AreaChangeEvents.kt + InjectDispatcher:ClipboardUtils.kt$ClipboardUtils$IO + InjectDispatcher:GardenNextJacobContest.kt$GardenNextJacobContest$IO + InjectDispatcher:HypixelBazaarFetcher.kt$HypixelBazaarFetcher$IO + InjectDispatcher:MayorAPI.kt$MayorAPI$IO + LongMethod:CopyNearbyEntitiesCommand.kt$CopyNearbyEntitiesCommand$fun command(args: Array<String>) + LongMethod:CropMoneyDisplay.kt$CropMoneyDisplay$private fun drawDisplay(): List<List<Any>> + LongMethod:DefaultConfigOptionGui.kt$DefaultConfigOptionGui$override fun drawScreen(mouseX: Int, mouseY: Int, partialTicks: Float) + LongMethod:GhostCounter.kt$GhostCounter$private fun drawDisplay() + LongMethod:GraphEditor.kt$GraphEditor$private fun input() + LongMethod:ItemDisplayOverlayFeatures.kt$ItemDisplayOverlayFeatures$private fun getStackTip(item: ItemStack): String? + LongMethod:MinecraftConsoleFilter.kt$MinecraftConsoleFilter$override fun filter(event: LogEvent?): Filter.Result + LongMethod:OverviewPage.kt$OverviewPage$private fun getPage(): Pair<List<List<Renderable>>, List<Renderable>> + LongMethod:RenderableTooltips.kt$RenderableTooltips$private fun drawHoveringText() + LongMethod:TabListRenderer.kt$TabListRenderer$private fun drawTabList() + LongMethod:VisualWordGui.kt$VisualWordGui$override fun drawScreen(unusedX: Int, unusedY: Int, partialTicks: Float) + LoopWithTooManyJumpStatements:AdvancedPlayerList.kt$AdvancedPlayerList$for + LoopWithTooManyJumpStatements:CropMoneyDisplay.kt$CropMoneyDisplay$for + LoopWithTooManyJumpStatements:CustomScoreboard.kt$CustomScoreboard$for + LoopWithTooManyJumpStatements:EstimatedItemValueCalculator.kt$EstimatedItemValueCalculator$for + LoopWithTooManyJumpStatements:GardenComposterInventoryFeatures.kt$GardenComposterInventoryFeatures$for + LoopWithTooManyJumpStatements:GardenVisitorFeatures.kt$GardenVisitorFeatures$for + LoopWithTooManyJumpStatements:IslandAreas.kt$IslandAreas$for + LoopWithTooManyJumpStatements:RiftBloodEffigies.kt$RiftBloodEffigies$for + LoopWithTooManyJumpStatements:SkyBlockItemModifierUtils.kt$SkyBlockItemModifierUtils$for + LoopWithTooManyJumpStatements:SkyHanniConfigSearchResetCommand.kt$SkyHanniConfigSearchResetCommand$for + LoopWithTooManyJumpStatements:SuperpairsClicksAlert.kt$SuperpairsClicksAlert$for + MapGetWithNotNullAssertionOperator:NavigationHelper.kt$NavigationHelper$distances[node]!! + MatchingDeclarationName:AreaChangeEvents.kt$ScoreboardAreaChangeEvent : SkyHanniEvent + MaxLineLength:GraphEditor.kt$GraphEditor$@Suppress("MapGetWithNotNullAssertionOperator") nodes[indexedTable[otherNode.id]!!] to node.position.distance(otherNode.position) + MemberNameEqualsClassName:CaptureFarmingGear.kt$CaptureFarmingGear$fun captureFarmingGear() + MemberNameEqualsClassName:Commands.kt$Commands$// command -> description private val commands = mutableListOf<CommandInfo>() + MemberNameEqualsClassName:FameRanks.kt$FameRanks$var fameRanks = emptyMap<String, FameRank>() private set + MemberNameEqualsClassName:FirstMinionTier.kt$FirstMinionTier$fun firstMinionTier( otherItems: Map<NEUInternalName, Int>, minions: MutableMap<String, NEUInternalName>, tierOneMinions: MutableList<NEUInternalName>, tierOneMinionsDone: MutableSet<NEUInternalName>, ) + MemberNameEqualsClassName:LastServers.kt$LastServers$private val lastServers = mutableMapOf<String, SimpleTimeMark>() + MemberNameEqualsClassName:PestSpawn.kt$PestSpawn$private fun pestSpawn(amount: Int, plotNames: List<String>, unknownAmount: Boolean) + MemberNameEqualsClassName:Shimmy.kt$Shimmy.Companion$private fun shimmy(source: Any?, fieldName: String): Any? + MemberNameEqualsClassName:TestBingo.kt$TestBingo$var testBingo = false + MemberNameEqualsClassName:Text.kt$Text$fun text(text: String, init: IChatComponent.() -> Unit = {}) + NoNameShadowing:BucketedItemTrackerData.kt$BucketedItemTrackerData${ it.hidden = !it.hidden } + NoNameShadowing:BurrowWarpHelper.kt$BurrowWarpHelper${ it.startsWith("§bWarp to ") } + NoNameShadowing:ChunkedStat.kt$ChunkedStat.Companion${ it.showWhen() } + NoNameShadowing:ContributorManager.kt$ContributorManager${ it.isAllowed() } + NoNameShadowing:Graph.kt$Graph.Companion${ out.name("Name").value(it) } + NoNameShadowing:Graph.kt$Graph.Companion${ out.name("Tags") out.beginArray() for (tagName in it) { out.value(tagName) } out.endArray() } + NoNameShadowing:GraphEditorBugFinder.kt$GraphEditorBugFinder${ it.position.distanceSqToPlayer() } + NoNameShadowing:GuiOptionEditorUpdateCheck.kt$GuiOptionEditorUpdateCheck$width + NoNameShadowing:HoppityCollectionStats.kt$HoppityCollectionStats${ val displayAmount = it.amount.shortFormat() val operationFormat = when (milestoneType) { HoppityEggType.CHOCOLATE_SHOP_MILESTONE -> "spending" HoppityEggType.CHOCOLATE_FACTORY_MILESTONE -> "reaching" else -> "" // Never happens } // List indexing is weird existingLore[replaceIndex - 1] = "§7Obtained by $operationFormat §6$displayAmount" existingLore[replaceIndex] = "§7all-time §6Chocolate." return existingLore } + NoNameShadowing:HotmData.kt$HotmData.Companion${ it.setCurrent(it.getTotal()) } + NoNameShadowing:LorenzVec.kt$LorenzVec.Companion$pitch + NoNameShadowing:LorenzVec.kt$LorenzVec.Companion$yaw + NoNameShadowing:Renderable.kt$Renderable.Companion.<no name provided>$posX + NoNameShadowing:Renderable.kt$Renderable.Companion.<no name provided>$posY + NoNameShadowing:Renderable.kt$Renderable.Companion.<no name provided>${ it.value?.contains(textInput.textBox, ignoreCase = true) ?: true } + NoNameShadowing:RenderableUtils.kt$RenderableUtils${ it != null } + NoNameShadowing:ReplaceRomanNumerals.kt$ReplaceRomanNumerals${ it.isValidRomanNumeral() && it.removeFormatting().romanToDecimal() != 2000 } + NoNameShadowing:RepoManager.kt$RepoManager${ unsuccessfulConstants.add(it) } + NoNameShadowing:RepoPatternManager.kt$RepoPatternManager${ it == '.' } + NoNameShadowing:Shimmy.kt$Shimmy.Companion$source + NoNameShadowing:SkyHanniBucketedItemTracker.kt$SkyHanniBucketedItemTracker${ ItemPriceSource.entries[it.ordinal] } + ReturnCount:AnitaMedalProfit.kt$AnitaMedalProfit$private fun readItem(slot: Int, item: ItemStack, table: MutableList<DisplayTableEntry>) + ReturnCount:BingoNextStepHelper.kt$BingoNextStepHelper$private fun readDescription(description: String): NextStep? + ReturnCount:BroodmotherFeatures.kt$BroodmotherFeatures$private fun onStageUpdate() + ReturnCount:ChatPeek.kt$ChatPeek$@JvmStatic fun peek(): Boolean + ReturnCount:ChestValue.kt$ChestValue$private fun isValidStorage(): Boolean + ReturnCount:CollectionTracker.kt$CollectionTracker$fun command(args: Array<String>) + ReturnCount:CompactBingoChat.kt$CompactBingoChat$private fun onSkyBlockLevelUp(message: String): Boolean + ReturnCount:CrimsonMinibossRespawnTimer.kt$CrimsonMinibossRespawnTimer$private fun updateArea() + ReturnCount:CropMoneyDisplay.kt$CropMoneyDisplay$private fun drawDisplay(): List<List<Any>> + ReturnCount:DamageIndicatorManager.kt$DamageIndicatorManager$private fun checkThorn(realHealth: Long, realMaxHealth: Long): String? + ReturnCount:DamageIndicatorManager.kt$DamageIndicatorManager$private fun getCustomHealth( entityData: EntityData, health: Long, entity: EntityLivingBase, maxHealth: Long, ): String? + ReturnCount:EnchantParser.kt$EnchantParser$private fun parseEnchants( loreList: MutableList<String>, enchants: Map<String, Int>, chatComponent: IChatComponent?, ) + ReturnCount:EstimatedItemValue.kt$EstimatedItemValue$private fun draw(stack: ItemStack): List<List<Any>> + ReturnCount:EstimatedItemValueCalculator.kt$EstimatedItemValueCalculator$private fun calculateStarPrice( internalName: NEUInternalName, inputStars: Int, ): Pair<EssenceItemUtils.EssenceUpgradePrice, Pair<Int, Int>>? + ReturnCount:FishingAPI.kt$FishingAPI$fun seaCreatureCount(entity: EntityArmorStand): Int + ReturnCount:GardenVisitorFeatures.kt$GardenVisitorFeatures$private fun showGui(): Boolean + ReturnCount:GraphEditor.kt$GraphEditor$private fun input() + ReturnCount:HideNotClickableItems.kt$HideNotClickableItems$private fun hideSalvage(chestName: String, stack: ItemStack): Boolean + ReturnCount:IslandGraphs.kt$IslandGraphs$private fun handleTick() + ReturnCount:ItemDisplayOverlayFeatures.kt$ItemDisplayOverlayFeatures$private fun getStackTip(item: ItemStack): String? + ReturnCount:ItemNameResolver.kt$ItemNameResolver$internal fun getInternalNameOrNull(itemName: String): NEUInternalName? + ReturnCount:ItemPriceUtils.kt$ItemPriceUtils$fun NEUInternalName.getPriceOrNull( priceSource: ItemPriceSource = ItemPriceSource.BAZAAR_INSTANT_BUY, pastRecipes: List<PrimitiveRecipe> = emptyList(), ): Double? + ReturnCount:ItemUtils.kt$ItemUtils$private fun NEUInternalName.grabItemName(): String + ReturnCount:MinecraftConsoleFilter.kt$MinecraftConsoleFilter$override fun filter(event: LogEvent?): Filter.Result + ReturnCount:MiningEventTracker.kt$MiningEventTracker$private fun sendData(eventName: String, time: String?) + ReturnCount:MobDetection.kt$MobDetection$private fun entitySpawn(entity: EntityLivingBase, roughType: Mob.Type): Boolean + ReturnCount:MobFilter.kt$MobFilter$internal fun createSkyblockEntity(baseEntity: EntityLivingBase): MobResult + ReturnCount:MobFilter.kt$MobFilter$private fun armorStandOnlyMobs(baseEntity: EntityLivingBase, armorStand: EntityArmorStand): MobResult? + ReturnCount:MobFilter.kt$MobFilter$private fun exceptions(baseEntity: EntityLivingBase, nextEntity: EntityLivingBase?): MobResult? + ReturnCount:MobFinder.kt$MobFinder$private fun tryAddEntitySpider(entity: EntityLivingBase): EntityResult? + ReturnCount:MobFinder.kt$MobFinder$private fun tryAddRift(entity: EntityLivingBase): EntityResult? + ReturnCount:MultiFilter.kt$MultiFilter$fun matchResult(string: String): String? + ReturnCount:PacketTest.kt$PacketTest$private fun Packet<*>.print() + ReturnCount:PowderMiningChatFilter.kt$PowderMiningChatFilter$@Suppress("CyclomaticComplexMethod") fun block(message: String): String? + ReturnCount:PurseAPI.kt$PurseAPI$private fun getCause(diff: Double): PurseChangeCause + ReturnCount:QuestLoader.kt$QuestLoader$private fun addQuest(name: String, state: QuestState, needAmount: Int): Quest + ReturnCount:ShowFishingItemName.kt$ShowFishingItemName$fun inCorrectArea(): Boolean + ReturnCount:SkillAPI.kt$SkillAPI$fun onCommand(it: Array<String>) + ReturnCount:SkyHanniConfigSearchResetCommand.kt$SkyHanniConfigSearchResetCommand$private suspend fun setCommand(args: Array<String>): String + ReturnCount:TabComplete.kt$TabComplete$private fun customTabComplete(command: String): List<String>? + SpreadOperator:ItemUtils.kt$ItemUtils$(tag, displayName, *lore.toTypedArray()) + SpreadOperator:LimboPlaytime.kt$LimboPlaytime$( itemID.getItemStack().item, ITEM_NAME, *createItemLore() ) + SpreadOperator:Text.kt$Text$(*component.toTypedArray(), separator = separator) + TooManyFunctions:CollectionUtils.kt$CollectionUtils + TooManyFunctions:DailyQuestHelper.kt$DailyQuestHelper + TooManyFunctions:EstimatedItemValueCalculator.kt$EstimatedItemValueCalculator + TooManyFunctions:GuiRenderUtils.kt$GuiRenderUtils + TooManyFunctions:HypixelCommands.kt$HypixelCommands + TooManyFunctions:InventoryUtils.kt$InventoryUtils + TooManyFunctions:LocationUtils.kt$LocationUtils + TooManyFunctions:LorenzUtils.kt$LorenzUtils + TooManyFunctions:LorenzVec.kt$LorenzVec + TooManyFunctions:MobFinder.kt$MobFinder + TooManyFunctions:NumberUtil.kt$NumberUtil + TooManyFunctions:RegexUtils.kt$RegexUtils + TooManyFunctions:RenderUtils.kt$RenderUtils + TooManyFunctions:Renderable.kt$Renderable$Companion + TooManyFunctions:ScoreboardElements.kt$at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardElements.kt + TooManyFunctions:ScoreboardEvent.kt$at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardEvent.kt + TooManyFunctions:SkyBlockItemModifierUtils.kt$SkyBlockItemModifierUtils + TooManyFunctions:StringUtils.kt$StringUtils + UnsafeCallOnNullableType:BasketWaypoints.kt$BasketWaypoints$Basket.entries.minByOrNull { it.waypoint.distanceSqToPlayer() }!! + UnsafeCallOnNullableType:BasketWaypoints.kt$BasketWaypoints$notFoundBaskets.minByOrNull { it.waypoint.distanceSqToPlayer() }!! + UnsafeCallOnNullableType:BucketedItemTrackerData.kt$BucketedItemTrackerData$it.value[internalName]?.hidden!! + UnsafeCallOnNullableType:ChocolateFactoryDataLoader.kt$ChocolateFactoryDataLoader$upgradeCost!! + UnsafeCallOnNullableType:CollectionUtils.kt$CollectionUtils$this.merge(key, number, Double::plus)!! + UnsafeCallOnNullableType:CollectionUtils.kt$CollectionUtils$this.merge(key, number, Float::plus)!! + UnsafeCallOnNullableType:CollectionUtils.kt$CollectionUtils$this.merge(key, number, Int::plus)!! + UnsafeCallOnNullableType:CollectionUtils.kt$CollectionUtils$this.merge(key, number, Long::plus)!! + UnsafeCallOnNullableType:CombatUtils.kt$CombatUtils$a!! + UnsafeCallOnNullableType:CompactBestiaryChatMessage.kt$CompactBestiaryChatMessage$it.groups[1]!! + UnsafeCallOnNullableType:ConfigManager.kt$ConfigManager$file!! + UnsafeCallOnNullableType:CorpseTracker.kt$CorpseTracker$applicableKeys.first().key!! + UnsafeCallOnNullableType:CosmeticFollowingLine.kt$CosmeticFollowingLine$latestLocations[b]!! + UnsafeCallOnNullableType:CosmeticFollowingLine.kt$CosmeticFollowingLine$locations[b]!! + UnsafeCallOnNullableType:CropMoneyDisplay.kt$CropMoneyDisplay$cropNames[internalName]!! + UnsafeCallOnNullableType:DailyMiniBossHelper.kt$DailyMiniBossHelper$getByDisplayName(name)!! + UnsafeCallOnNullableType:DamageIndicatorManager.kt$DamageIndicatorManager$data.deathLocation!! + UnsafeCallOnNullableType:DefaultConfigFeatures.kt$DefaultConfigFeatures$resetSuggestionState[cat]!! + UnsafeCallOnNullableType:DefaultConfigOptionGui.kt$DefaultConfigOptionGui$resetSuggestionState[cat]!! + UnsafeCallOnNullableType:DicerRngDropTracker.kt$DicerRngDropTracker$event.toolItem!! + UnsafeCallOnNullableType:DiscordStatus.kt$ownerRegex.find(colorlessLine)!! + UnsafeCallOnNullableType:DungeonAPI.kt$DungeonAPI$dungeonFloor!! + UnsafeCallOnNullableType:EasterEggWaypoints.kt$EasterEggWaypoints$EasterEgg.entries.minByOrNull { it.waypoint.distanceSqToPlayer() }!! + UnsafeCallOnNullableType:EasterEggWaypoints.kt$EasterEggWaypoints$notFoundEggs.minByOrNull { it.waypoint.distanceSqToPlayer() }!! + UnsafeCallOnNullableType:EntityMovementData.kt$EntityMovementData$entityLocation[entity]!! + UnsafeCallOnNullableType:EntityOutlineRenderer.kt$EntityOutlineRenderer$entityRenderCache.noXrayCache!! + UnsafeCallOnNullableType:EntityOutlineRenderer.kt$EntityOutlineRenderer$entityRenderCache.xrayCache!! + UnsafeCallOnNullableType:EntityOutlineRenderer.kt$EntityOutlineRenderer$frameToCopy!! + UnsafeCallOnNullableType:EntityOutlineRenderer.kt$EntityOutlineRenderer$frameToPaste!! + UnsafeCallOnNullableType:EntityOutlineRenderer.kt$EntityOutlineRenderer$isAntialiasing!! + UnsafeCallOnNullableType:EntityOutlineRenderer.kt$EntityOutlineRenderer$isFastRender!! + UnsafeCallOnNullableType:EntityOutlineRenderer.kt$EntityOutlineRenderer$isShaders!! + UnsafeCallOnNullableType:FFGuideGUI.kt$FFGuideGUI$currentCrop!! + UnsafeCallOnNullableType:FarmingContestAPI.kt$FarmingContestAPI$contestCrop!! + UnsafeCallOnNullableType:FarmingContestAPI.kt$FarmingContestAPI$contests[bracket]!! + UnsafeCallOnNullableType:FarmingContestAPI.kt$FarmingContestAPI$currentCrop!! + UnsafeCallOnNullableType:FarmingWeightDisplay.kt$FarmingWeightDisplay$weightPerCrop[CropType.CACTUS]!! + UnsafeCallOnNullableType:FarmingWeightDisplay.kt$FarmingWeightDisplay$weightPerCrop[CropType.SUGAR_CANE]!! + UnsafeCallOnNullableType:FeatureToggleProcessor.kt$FeatureToggleProcessor$latestCategory!! + UnsafeCallOnNullableType:FeatureTogglesByDefaultAdapter.kt$FeatureTogglesByDefaultAdapter$gson!! + UnsafeCallOnNullableType:FishingProfitTracker.kt$FishingProfitTracker$itemCategories[currentCategory]!! + UnsafeCallOnNullableType:FishingProfitTracker.kt$FishingProfitTracker.Data$itemCategories["Trophy Fish"]!! + UnsafeCallOnNullableType:FortuneUpgrades.kt$FortuneUpgrades$nextTalisman.upgradeCost?.first!! + UnsafeCallOnNullableType:GardenComposterUpgradesData.kt$GardenComposterUpgradesData$ComposterUpgrade.getByName(name)!! + UnsafeCallOnNullableType:GardenCropMilestoneDisplay.kt$GardenCropMilestoneDisplay$cultivatingData[crop]!! + UnsafeCallOnNullableType:GardenCropMilestonesCommunityFix.kt$GardenCropMilestonesCommunityFix$map[crop]!! + UnsafeCallOnNullableType:GardenPlotIcon.kt$GardenPlotIcon$originalStack[index]!! + UnsafeCallOnNullableType:GhostCounter.kt$GhostCounter$storage?.totalMF!! + UnsafeCallOnNullableType:Graph.kt$Graph.Companion$position!! + UnsafeCallOnNullableType:Graph.kt$distances.distances[end]!! + UnsafeCallOnNullableType:GriffinBurrowHelper.kt$GriffinBurrowHelper$particleBurrows[targetLocation]!! + UnsafeCallOnNullableType:HoppityCallWarning.kt$HoppityCallWarning$acceptUUID!! + UnsafeCallOnNullableType:IslandGraphs.kt$IslandGraphs$currentTarget!! + UnsafeCallOnNullableType:ItemBlink.kt$ItemBlink$offsets[item]!! + UnsafeCallOnNullableType:ItemPickupLog.kt$ItemPickupLog$listToCheckAgainst[key]!! + UnsafeCallOnNullableType:ItemPickupLog.kt$ItemPickupLog$listToCheckAgainst[key]?.second!! + UnsafeCallOnNullableType:ItemStackTypeAdapterFactory.kt$ItemStackTypeAdapterFactory$gson!! + UnsafeCallOnNullableType:ItemUtils.kt$ItemUtils$itemAmountCache[input]!! + UnsafeCallOnNullableType:JacobContestTimeNeeded.kt$JacobContestTimeNeeded$map[crop]!! + UnsafeCallOnNullableType:KSerializable.kt$KotlinTypeAdapterFactory$kotlinClass.memberProperties.find { it.name == param.name }!! + UnsafeCallOnNullableType:KSerializable.kt$KotlinTypeAdapterFactory$param.name!! + UnsafeCallOnNullableType:LorenzEvent.kt$LorenzEvent$this::class.simpleName!! + UnsafeCallOnNullableType:MinionFeatures.kt$MinionFeatures$newMinion!! + UnsafeCallOnNullableType:MobFinder.kt$MobFinder$floor6GiantsSeparateDelay[uuid]!! + UnsafeCallOnNullableType:NavigationHelper.kt$NavigationHelper$distances[node]!! + UnsafeCallOnNullableType:NumberUtil.kt$NumberUtil$romanSymbols[this]!! + UnsafeCallOnNullableType:PositionList.kt$PositionList$configLink!! + UnsafeCallOnNullableType:ReminderManager.kt$ReminderManager$storage[args.drop(1).first()]!! + UnsafeCallOnNullableType:ReminderManager.kt$ReminderManager$storage[args.first()]!! + UnsafeCallOnNullableType:RenderEntityOutlineEvent.kt$RenderEntityOutlineEvent$entitiesToChooseFrom!! + UnsafeCallOnNullableType:RenderEntityOutlineEvent.kt$RenderEntityOutlineEvent$entitiesToOutline!! + UnsafeCallOnNullableType:RenderGlobalHook.kt$RenderGlobalHook$camera!! + UnsafeCallOnNullableType:RenderLivingEntityHelper.kt$RenderLivingEntityHelper$entityColorCondition[entity]!! + UnsafeCallOnNullableType:RenderLivingEntityHelper.kt$RenderLivingEntityHelper$entityColorMap[entity]!! + UnsafeCallOnNullableType:RenderUtils.kt$RenderUtils$it.name!! + UnsafeCallOnNullableType:RepoManager.kt$RepoManager$latestRepoCommit!! + UnsafeCallOnNullableType:RepoUtils.kt$RepoUtils$file!! + UnsafeCallOnNullableType:SackAPI.kt$SackAPI$match.groups[1]!! + UnsafeCallOnNullableType:SackAPI.kt$SackAPI$match.groups[2]!! + UnsafeCallOnNullableType:SackAPI.kt$SackAPI$match.groups[3]!! + UnsafeCallOnNullableType:SackAPI.kt$SackAPI$oldData!! + UnsafeCallOnNullableType:SimpleCommand.kt$SimpleCommand$tabRunnable!! + UnsafeCallOnNullableType:SkyHanniBucketedItemTracker.kt$SkyHanniBucketedItemTracker$it.get(DisplayMode.SESSION).getItemsProp()[internalName]!! + UnsafeCallOnNullableType:SkyHanniBucketedItemTracker.kt$SkyHanniBucketedItemTracker$it.get(DisplayMode.TOTAL).getItemsProp()[internalName]!! + UnsafeCallOnNullableType:SkyHanniMod.kt$SkyHanniMod.Companion$Loader.instance().indexedModList[MODID]!! + UnsafeCallOnNullableType:SoopyGuessBurrow.kt$SoopyGuessBurrow$distance!! + UnsafeCallOnNullableType:SoopyGuessBurrow.kt$SoopyGuessBurrow$distance2!! + UnsafeCallOnNullableType:SoopyGuessBurrow.kt$SoopyGuessBurrow$firstParticlePoint?.distance(pos)!! + UnsafeCallOnNullableType:SoopyGuessBurrow.kt$SoopyGuessBurrow$lastParticlePoint2!! + UnsafeCallOnNullableType:SoopyGuessBurrow.kt$SoopyGuessBurrow$lastParticlePoint2?.distance(particlePoint!!)!! + UnsafeCallOnNullableType:SoopyGuessBurrow.kt$SoopyGuessBurrow$particlePoint!! + UnsafeCallOnNullableType:SoopyGuessBurrow.kt$SoopyGuessBurrow$particlePoint?.subtract(lastParticlePoint2!!)!! + UnsafeCallOnNullableType:SummoningSoulsName.kt$SummoningSoulsName$mobsName.getOrNull(nearestMob)!! + UnsafeCallOnNullableType:SuperpairsClicksAlert.kt$SuperpairsClicksAlert$match.groups[1]!! + UnsafeCallOnNullableType:TiaRelayWaypoints.kt$TiaRelayWaypoints$waypointName!! + UnsafeCallOnNullableType:Translator.kt$Translator$messageContentRegex.find(message)!! + UnsafeCallOnNullableType:TrevorFeatures.kt$TrevorFeatures$TrevorSolver.currentMob!! + UnsafeCallOnNullableType:TrevorSolver.kt$TrevorSolver$currentMob!! + UnsafeCallOnNullableType:TunnelsMaps.kt$TunnelsMaps$campfire.name!! + UnsafeCallOnNullableType:UpdateManager.kt$UpdateManager$potentialUpdate!! + UnsafeCallOnNullableType:VisitorRewardWarning.kt$VisitorRewardWarning$visitor.totalPrice!! + UnsafeCallOnNullableType:VisitorRewardWarning.kt$VisitorRewardWarning$visitor.totalReward!! + UnusedParameter:SkyHanniDebugsAndTests.kt$SkyHanniDebugsAndTests$args: Array<String> + UseIsNullOrEmpty:ItemUtils.kt$ItemUtils$name == null || name.isEmpty() + UseOrEmpty:SkyHanniDebugsAndTests.kt$SkyHanniDebugsAndTests$event.originalOre?.let { "$it " } ?: "" + VarCouldBeVal:AdvancedPlayerList.kt$AdvancedPlayerList$private var randomOrderCache = TimeLimitedCache<String, Int>(20.minutes) + VarCouldBeVal:BestiaryData.kt$BestiaryData$private var indexes = listOf( 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43 ) + VarCouldBeVal:BucketedItemTrackerData.kt$BucketedItemTrackerData$@Expose private var bucketedItems: MutableMap<E, MutableMap<NEUInternalName, TrackedItem>> = HashMap() + VarCouldBeVal:CarnivalZombieShootout.kt$CarnivalZombieShootout$private var lastUpdate = Updates(SimpleTimeMark.farPast(), SimpleTimeMark.farPast()) + VarCouldBeVal:ChocolateFactoryStrayTracker.kt$ChocolateFactoryStrayTracker$private var claimedStraysSlots = mutableListOf<Int>() + VarCouldBeVal:CompactBestiaryChatMessage.kt$CompactBestiaryChatMessage$private var bestiaryDescription = mutableListOf<String>() + VarCouldBeVal:CompactExperimentRewards.kt$CompactExperimentRewards$private var gainedRewards = mutableListOf<String>() + VarCouldBeVal:CraftRoomHolographicMob.kt$CraftRoomHolographicMob$private var entityToHolographicEntity = mapOf( EntityZombie::class.java to HolographicEntities.zombie, EntitySlime::class.java to HolographicEntities.slime, EntityCaveSpider::class.java to HolographicEntities.caveSpider, ) + VarCouldBeVal:CustomWardrobe.kt$CustomWardrobe$private var guiName = "Custom Wardrobe" + VarCouldBeVal:Enchant.kt$Enchant$@Expose private var goodLevel = 0 + VarCouldBeVal:Enchant.kt$Enchant$@Expose private var maxLevel = 0 + VarCouldBeVal:Enchant.kt$Enchant.Stacking$@Expose @Suppress("unused") private var statLabel: String? = null + VarCouldBeVal:Enchant.kt$Enchant.Stacking$@Expose private var nbtNum: String? = null + VarCouldBeVal:Enchant.kt$Enchant.Stacking$@Expose private var stackLevel: TreeSet<Int>? = null + VarCouldBeVal:ErrorManager.kt$ErrorManager$private var cache = TimeLimitedSet<Pair<String, Int>>(10.minutes) + VarCouldBeVal:EstimatedItemValueCalculator.kt$EstimatedItemValueCalculator$var comboPrice = combo.asInternalName().getPriceOrNull() + VarCouldBeVal:EstimatedItemValueCalculator.kt$EstimatedItemValueCalculator$var internalName = removeKuudraArmorPrefix(stack.getInternalName().asString().removePrefix("VANQUISHED_")) + VarCouldBeVal:EstimatedItemValueCalculator.kt$EstimatedItemValueCalculator$var nameColor = if (!useless) "§9" else "§7" + VarCouldBeVal:ExperimentsProfitTracker.kt$ExperimentsProfitTracker$private var currentBottlesInInventory = mutableMapOf<NEUInternalName, Int>() + VarCouldBeVal:ExperimentsProfitTracker.kt$ExperimentsProfitTracker$private var lastBottlesInInventory = mutableMapOf<NEUInternalName, Int>() + VarCouldBeVal:ExperimentsProfitTracker.kt$ExperimentsProfitTracker$private var lastSplashes = mutableListOf<ItemStack>() + VarCouldBeVal:FarmingWeightDisplay.kt$FarmingWeightDisplay$private var nextPlayers = mutableListOf<UpcomingLeaderboardPlayer>() + VarCouldBeVal:FlareDisplay.kt$FlareDisplay$private var flares = mutableListOf<Flare>() + VarCouldBeVal:FontRendererHook.kt$FontRendererHook$private var CHROMA_COLOR: Int = -0x1 + VarCouldBeVal:FontRendererHook.kt$FontRendererHook$private var CHROMA_COLOR_SHADOW: Int = -0xAAAAAB + VarCouldBeVal:GardenPlotIcon.kt$GardenPlotIcon$private var cachedStack = mutableMapOf<Int, ItemStack>() + VarCouldBeVal:GardenPlotIcon.kt$GardenPlotIcon$private var originalStack = mutableMapOf<Int, ItemStack>() + VarCouldBeVal:GardenPlotMenuHighlighting.kt$GardenPlotMenuHighlighting$private var highlightedPlots = mutableMapOf<GardenPlotAPI.Plot, PlotStatusType>() + VarCouldBeVal:GardenVisitorColorNames.kt$GardenVisitorColorNames$private var visitorColors = mutableMapOf<String, String>() // name -> color code + VarCouldBeVal:GhostData.kt$GhostData$private var session = mutableMapOf( Option.KILLS to 0.0, Option.SORROWCOUNT to 0.0, Option.VOLTACOUNT to 0.0, Option.PLASMACOUNT to 0.0, Option.GHOSTLYBOOTS to 0.0, Option.BAGOFCASH to 0.0, Option.TOTALDROPS to 0.0, Option.SCAVENGERCOINS to 0.0, Option.MAXKILLCOMBO to 0.0, Option.SKILLXPGAINED to 0.0 ) + VarCouldBeVal:GraphEditor.kt$GraphEditor$var vector = LocationUtils.calculatePlayerFacingDirection() + VarCouldBeVal:HoppityCollectionStats.kt$HoppityCollectionStats$private var highlightMap = mutableMapOf<String, LorenzColor>() + VarCouldBeVal:HoppityEggLocations.kt$HoppityEggLocations$// TODO add gui/command to show total data/missing islands private var collectedEggStorage: MutableMap<IslandType, MutableSet<LorenzVec>> get() = ChocolateFactoryAPI.profileStorage?.collectedEggLocations ?: mutableMapOf() set(value) { ChocolateFactoryAPI.profileStorage?.collectedEggLocations = value } + VarCouldBeVal:HoppityNpc.kt$HoppityNpc$private var slotsToHighlight = mutableSetOf<Int>() + VarCouldBeVal:IslandAreas.kt$IslandAreas$var suffix = "" + VarCouldBeVal:ItemPickupLog.kt$ItemPickupLog$private var itemList = mutableMapOf<Int, Pair<ItemStack, Int>>() + VarCouldBeVal:ItemPickupLog.kt$ItemPickupLog$private var itemsAddedToInventory = mutableMapOf<Int, PickupEntry>() + VarCouldBeVal:ItemPickupLog.kt$ItemPickupLog$private var itemsRemovedFromInventory = mutableMapOf<Int, PickupEntry>() + VarCouldBeVal:LocationUtils.kt$LocationUtils$var yaw = LocationUtils.calculatePlayerYaw() + 180 + VarCouldBeVal:LorenzLogger.kt$LorenzLogger.Companion$private var LOG_DIRECTORY = File("config/skyhanni/logs") + VarCouldBeVal:MobDetection.kt$MobDetection$private var shouldClear: AtomicBoolean = AtomicBoolean(false) + VarCouldBeVal:MobFinder.kt$MobFinder$private var floor2summonsDiedOnce = mutableListOf<EntityOtherPlayerMP>() + VarCouldBeVal:MobFinder.kt$MobFinder$private var floor6GiantsSeparateDelay = mutableMapOf<UUID, Pair<Long, BossType>>() + VarCouldBeVal:MobFinder.kt$MobFinder$private var guardians = mutableListOf<EntityGuardian>() + VarCouldBeVal:NeuReforgeJson.kt$NeuReforgeJson$private lateinit var itemTypeField: Pair<String, List<NEUInternalName>> + VarCouldBeVal:PowerStoneGuideFeatures.kt$PowerStoneGuideFeatures$private var missing = mutableMapOf<Int, NEUInternalName>() + VarCouldBeVal:PunchcardHighlight.kt$PunchcardHighlight$private var playerQueue = mutableListOf<String>() + VarCouldBeVal:QuiverWarning.kt$QuiverWarning$private var arrowsInInstance = mutableSetOf<ArrowType>() + VarCouldBeVal:ReforgeHelper.kt$ReforgeHelper$private var waitForChat = AtomicBoolean(false) + VarCouldBeVal:ReminderManager.kt$ReminderManager$private var listPage = 1 + VarCouldBeVal:RepoPatternGui.kt$RepoPatternGui$private var searchCache = ObservableList(mutableListOf<RepoPatternInfo>()) + VarCouldBeVal:RepoPatternManager.kt$RepoPatternManager$/** * Map containing all keys and their repo patterns. Used for filling in new regexes after an update, and for * checking duplicate registrations. */ private var usedKeys: NavigableMap<String, CommonPatternInfo<*, *>> = TreeMap() + VarCouldBeVal:RepoPatternManager.kt$RepoPatternManager$/** * Map containing the exclusive owner of a regex key */ private var exclusivity: MutableMap<String, RepoPatternKeyOwner> = mutableMapOf() + VarCouldBeVal:SeaCreatureFeatures.kt$SeaCreatureFeatures$private var entityIds = TimeLimitedSet<Int>(6.minutes) + VarCouldBeVal:SeaCreatureFeatures.kt$SeaCreatureFeatures$private var rareSeaCreatures = TimeLimitedSet<Mob>(6.minutes) + VarCouldBeVal:ShowFishingItemName.kt$ShowFishingItemName$private var itemsOnGround = TimeLimitedCache<EntityItem, String>(750.milliseconds) + VarCouldBeVal:SkyblockGuideHighlightFeature.kt$SkyblockGuideHighlightFeature.Companion$private var missing = mutableSetOf<Int>() + VarCouldBeVal:SlayerItemsOnGround.kt$SlayerItemsOnGround$private var itemsOnGround = TimeLimitedCache<EntityItem, String>(2.seconds) + VarCouldBeVal:SoopyGuessBurrow.kt$SoopyGuessBurrow$private var dingSlope = mutableListOf<Float>() + VarCouldBeVal:SoopyGuessBurrow.kt$SoopyGuessBurrow$private var locations = mutableListOf<LorenzVec>() + VarCouldBeVal:SuperpairExperimentInformationDisplay.kt$SuperpairExperimentInformationDisplay$// TODO remove string. use enum instead! maybe even create new data type instead of map of pairs private var found = mutableMapOf<Pair<Item?, ItemPair?>, String>() + VarCouldBeVal:SuperpairExperimentInformationDisplay.kt$SuperpairExperimentInformationDisplay$private var lastClicked = mutableListOf<Pair<Int, Int>>() + VarCouldBeVal:SuperpairExperimentInformationDisplay.kt$SuperpairExperimentInformationDisplay$private var toCheck = mutableListOf<Pair<Int, Int>>() + VarCouldBeVal:SuperpairExperimentInformationDisplay.kt$SuperpairExperimentInformationDisplay$private var uncoveredItems = mutableListOf<Pair<Int, String>>() + VarCouldBeVal:TiaRelayHelper.kt$TiaRelayHelper$private var resultDisplay = mutableMapOf<Int, Int>() + VarCouldBeVal:TiaRelayHelper.kt$TiaRelayHelper$private var sounds = mutableMapOf<Int, Sound>() + VarCouldBeVal:Translator.kt$Translator$var lang = config.languageCode.get() + VarCouldBeVal:TrevorFeatures.kt$TrevorFeatures$private var backupTrapperID: Int = 17 + VarCouldBeVal:TrevorFeatures.kt$TrevorFeatures$private var trapperID: Int = 56 + VarCouldBeVal:TrophyFishDisplay.kt$TrophyFishDisplay$private var recentlyDroppedTrophies = TimeLimitedCache<NEUInternalName, TrophyRarity>(5.seconds) + VarCouldBeVal:UserLuckBreakdown.kt$UserLuckBreakdown$private var fillerID = "STAINED_GLASS_PANE".asInternalName() + VarCouldBeVal:UserLuckBreakdown.kt$UserLuckBreakdown$private var limboID = "ENDER_PEARL".asInternalName() + VarCouldBeVal:UserLuckBreakdown.kt$UserLuckBreakdown$private var skillOverflowLuck = mutableMapOf<SkillType, Int>() + VarCouldBeVal:UserLuckBreakdown.kt$UserLuckBreakdown$private var skillsID = "DIAMOND_SWORD".asInternalName() + + diff --git a/detekt/build.gradle.kts b/detekt/build.gradle.kts new file mode 100644 index 000000000..ce0de9ace --- /dev/null +++ b/detekt/build.gradle.kts @@ -0,0 +1,13 @@ +plugins { + kotlin("jvm") + id("com.google.devtools.ksp") +} + +dependencies { + implementation("io.gitlab.arturbosch.detekt:detekt-api:1.23.7") + ksp(libs.autoservice.ksp) + implementation(libs.autoservice.annotations) + implementation("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.7") + testImplementation("io.kotest:kotest-assertions-core:5.9.1") + testImplementation("io.gitlab.arturbosch.detekt:detekt-test:1.23.7") +} diff --git a/detekt/detekt.yml b/detekt/detekt.yml new file mode 100644 index 000000000..1b7d3ab05 --- /dev/null +++ b/detekt/detekt.yml @@ -0,0 +1,127 @@ + +config: + validation: true + +GrammarRules: + active: true + AvoidColour: # custom rule to prefer color to colour + active: true + +FormattingRules: + active: true + CustomCommentSpacing: + active: true + + +style: + MagicNumber: # I, Linnea Gräf, of sound mind and body, disagree with disabling this rule + active: false + UnusedParameter: + active: true + ignoreAnnotated: + - 'SubscribeEvent' + - 'HandleEvent' + - 'Mod.EventHandler' + ReturnCount: + active: true + max: 5 + excludeGuardClauses: true + ignoreAnnotated: + - 'SubscribeEvent' + - 'HandleEvent' + - 'Mod.EventHandler' + MaxLineLength: + active: true + maxLineLength: 140 + excludeCommentStatements: true + LoopWithTooManyJumpStatements: + active: true + maxJumpCount: 3 + UnnecessaryAbstractClass: # gets horrendously messed up with Event classes + active: false + UnusedPrivateMember: # gets tripped up by API methods + active: false + UnusedPrivateProperty: # loops that don't use their iterator + active: true + allowedNames: "^(unused|_)$" + UseCheckOrError: + active: false + ForbiddenComment: # every TODO gets flagged + active: false + DestructuringDeclarationWithTooManyEntries: # too aggressive + active: true + maxDestructuringEntries: 5 + +formatting: + MaximumLineLength: # ktlint - handled by detekt + active: false + MultiLineIfElse: + active: false + ArgumentListWrapping: # ktlint - way too aggressive + active: false + NoBlankLineBeforeRbrace: # pedantic + active: false + NoConsecutiveBlankLines: # pedantic + active: false + NoEmptyFirstLineInMethodBlock: # pedantic + active: false + ParameterListWrapping: # pedantic, can be useful in compact code + active: false + CommentSpacing: # handled by custom rule + active: false + SpacingBetweenDeclarationsWithAnnotations: # nah + active: false + SpacingBetweenDeclarationsWithComments: # also nah + active: false + +complexity: + CyclomaticComplexMethod: # default threshold of 15, caught almost every complex method + active: true + threshold: 25 + ignoreAnnotated: + - 'SubscribeEvent' + - 'HandleEvent' + - 'Mod.EventHandler' + LongParameterList: # too aggressive, classes can need a lot of params + active: false + NestedBlockDepth: # too aggressive + active: false + TooManyFunctions: # ktlint - also way too aggressive by default (11 on all file types) + active: true + thresholdInFiles: 15 + thresholdInClasses: 20 + thresholdInInterfaces: 20 + thresholdInObjects: 20 + thresholdInEnums: 11 + ignoreAnnotated: + - 'SkyHanniModule' + ComplexCondition: # aggressive by default, at a complexity of 4 + active: true + threshold: 6 + LongMethod: # default max length of 60, caught way too much + active: true + threshold: 100 + ignoreAnnotated: + - 'SubscribeEvent' + - 'HandleEvent' + - 'Mod.EventHandler' + +exceptions: + SwallowedException: # there are valid reasons to do this + active: false + ThrowingExceptionsWithoutMessageOrCause: # again, valid reasons + active: false + TooGenericExceptionCaught: # sometimes you just need to catch Exception + active: false + TooGenericExceptionThrown: # we don't have our own custom exceptions + active: false + +naming: + ConstructorParameterNaming: # pedantic + active: false + +potential-bugs: + DoubleMutabilityForCollection: # went crazy about all the mutable collections + active: false + HasPlatformType: # false positives on config get() methods + active: false diff --git a/detekt/src/main/kotlin/formatting/CustomCommentSpacing.kt b/detekt/src/main/kotlin/formatting/CustomCommentSpacing.kt new file mode 100644 index 000000000..aaf7896cf --- /dev/null +++ b/detekt/src/main/kotlin/formatting/CustomCommentSpacing.kt @@ -0,0 +1,51 @@ +package at.hannibal2.skyhanni.detektrules.formatting + +import io.gitlab.arturbosch.detekt.api.CodeSmell +import io.gitlab.arturbosch.detekt.api.Config +import io.gitlab.arturbosch.detekt.api.Debt +import io.gitlab.arturbosch.detekt.api.Entity +import io.gitlab.arturbosch.detekt.api.Issue +import io.gitlab.arturbosch.detekt.api.Rule +import io.gitlab.arturbosch.detekt.api.Severity +import org.jetbrains.kotlin.com.intellij.psi.PsiComment + +class CustomCommentSpacing(config: Config) : Rule(config) { + override val issue = Issue( + "CustomCommentSpacing", + Severity.Style, + "Enforces custom spacing rules for comments.", + Debt.FIVE_MINS + ) + + private val allowedPatterns = listOf( + "#if", + "#else", + "#elseif", + "#endif", + "$$" + ) + + override fun visitComment(comment: PsiComment) { + if (allowedPatterns.any { comment.text.contains(it) }) { + return + } + + /** + * REGEX-TEST: // Test comment + * REGEX-TEST: /* Test comment */ + */ + val commentRegex = Regex("""^(?:\/{2}|\/\*)(?:\s.*|$)""", RegexOption.DOT_MATCHES_ALL) + if (!commentRegex.matches(comment.text)) { + report( + CodeSmell( + issue, + Entity.from(comment), + "Expected space after opening comment." + ) + ) + } + + // Fallback to super (ostensibly a no-check) + super.visitComment(comment) + } +} diff --git a/detekt/src/main/kotlin/formatting/FormattingRuleSetProvider.kt b/detekt/src/main/kotlin/formatting/FormattingRuleSetProvider.kt new file mode 100644 index 000000000..a0a969bcf --- /dev/null +++ b/detekt/src/main/kotlin/formatting/FormattingRuleSetProvider.kt @@ -0,0 +1,17 @@ +package at.hannibal2.skyhanni.detektrules.formatting + +import com.google.auto.service.AutoService +import io.gitlab.arturbosch.detekt.api.Config +import io.gitlab.arturbosch.detekt.api.RuleSet +import io.gitlab.arturbosch.detekt.api.RuleSetProvider + +@AutoService(RuleSetProvider::class) +class FormattingRuleSetProvider : RuleSetProvider { + override val ruleSetId: String = "FormattingRules" + + override fun instance(config: Config): RuleSet { + return RuleSet(ruleSetId, listOf( + CustomCommentSpacing(config) + )) + } +} diff --git a/detekt/src/main/kotlin/grammar/AvoidColour.kt b/detekt/src/main/kotlin/grammar/AvoidColour.kt new file mode 100644 index 000000000..754148d36 --- /dev/null +++ b/detekt/src/main/kotlin/grammar/AvoidColour.kt @@ -0,0 +1,38 @@ +package at.hannibal2.skyhanni.detektrules.grammar + +import io.gitlab.arturbosch.detekt.api.CodeSmell +import io.gitlab.arturbosch.detekt.api.Config +import io.gitlab.arturbosch.detekt.api.Debt +import io.gitlab.arturbosch.detekt.api.Entity +import io.gitlab.arturbosch.detekt.api.Issue +import io.gitlab.arturbosch.detekt.api.Rule +import io.gitlab.arturbosch.detekt.api.Severity +import org.jetbrains.kotlin.psi.KtStringTemplateExpression + +/** + * This rule reports all usages of the word "colour" in the codebase, + * preferring the 'American' spelling "color" - this will ignore any + * type annotations, i.e., `@ConfigEditorColour` will not be reported. + */ +class AvoidColour(config: Config) : Rule(config) { + override val issue = Issue( + "AvoidColour", + Severity.Style, + "Avoid using the word 'colour' in code, prefer 'color' instead.", + Debt.FIVE_MINS + ) + + override fun visitStringTemplateExpression(expression: KtStringTemplateExpression) { + val text = expression.text // Be aware .getText() returns the entire span of this template, including variable names contained within. This should be rare enough of a problem for us to not care about it. + if (text.contains("colour", ignoreCase = true)) { + report( + CodeSmell( + issue, + Entity.from(expression), + "Avoid using the word 'colour' in code, prefer 'color' instead." + ) + ) + } + super.visitStringTemplateExpression(expression) + } +} diff --git a/detekt/src/main/kotlin/grammar/GrammarRuleSetProvider.kt b/detekt/src/main/kotlin/grammar/GrammarRuleSetProvider.kt new file mode 100644 index 000000000..957b20147 --- /dev/null +++ b/detekt/src/main/kotlin/grammar/GrammarRuleSetProvider.kt @@ -0,0 +1,17 @@ +package at.hannibal2.skyhanni.detektrules.grammar + +import com.google.auto.service.AutoService +import io.gitlab.arturbosch.detekt.api.Config +import io.gitlab.arturbosch.detekt.api.RuleSet +import io.gitlab.arturbosch.detekt.api.RuleSetProvider + +@AutoService(RuleSetProvider::class) +class GrammarRuleSetProvider : RuleSetProvider { + override val ruleSetId: String = "GrammarRules" + + override fun instance(config: Config): RuleSet { + return RuleSet(ruleSetId, listOf( + AvoidColour(config) + )) + } +} diff --git a/detekt/src/main/kotlin/root.kt b/detekt/src/main/kotlin/root.kt new file mode 100644 index 000000000..9b95a398f --- /dev/null +++ b/detekt/src/main/kotlin/root.kt @@ -0,0 +1 @@ +package at.hannibal2.skyhanni.detektrules diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 634e49064..926ed0285 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,3 +10,6 @@ libautoupdate = { module = "moe.nea:libautoupdate", version.ref = "libautoupdate headlessLwjgl = { module = "com.github.3arthqu4ke.HeadlessMc:headlessmc-lwjgl", version.ref = "headlessLwjgl" } jbAnnotations = { module = "org.jetbrains:annotations", version.ref = "jbAnnotations" } hotswapagentforge = { module = "moe.nea:hotswapagent-forge", version = "1.0.1" } +autoservice_ksp = {module="dev.zacsweers.autoservice:auto-service-ksp",version="1.1.0"} +autoservice_annotations = {module="com.google.auto.service:auto-service-annotations",version="1.1.1"} + diff --git a/root.gradle.kts b/root.gradle.kts index 5baae39e2..010393942 100644 --- a/root.gradle.kts +++ b/root.gradle.kts @@ -9,11 +9,32 @@ plugins { kotlin("plugin.power-assert") version "2.0.0" apply false id("com.google.devtools.ksp") version "2.0.0-1.0.24" apply false id("dev.architectury.architectury-pack200") version "0.1.3" + id("io.gitlab.arturbosch.detekt") version "1.23.7" apply false } allprojects { group = "at.hannibal2.skyhanni" version = "0.27.Beta.12" + repositories { + mavenCentral() + mavenLocal() + maven("https://maven.minecraftforge.net") { + metadataSources { + artifact() // We love missing POMs + } + } + maven("https://repo.spongepowered.org/maven/") // mixin + maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1") // DevAuth + maven("https://jitpack.io") { // NotEnoughUpdates (compiled against) + content { + includeGroupByRegex("(com|io)\\.github\\..*") + } + } + maven("https://repo.nea.moe/releases") // libautoupdate + maven("https://maven.notenoughupdates.org/releases") // NotEnoughUpdates (dev env) + maven("https://repo.hypixel.net/repository/Hypixel/") // mod-api + maven("https://maven.teamresourceful.com/repository/thatgravyboat/") // DiscordIPC + } } preprocess { diff --git a/settings.gradle.kts b/settings.gradle.kts index adee2acba..987b70013 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -38,6 +38,7 @@ plugins { Mul