aboutsummaryrefslogtreecommitdiff
path: root/build.gradle.kts
diff options
context:
space:
mode:
authorDavid Cole <40234707+DavidArthurCole@users.noreply.github.com>2024-09-26 03:56:44 -0400
committerGitHub <noreply@github.com>2024-09-26 09:56:44 +0200
commit092a29dd8b13c2b04b0b7c259446ab697201dd5e (patch)
treef3704e259d34bfccef083834cb9106578695a694 /build.gradle.kts
parente90fd65559ef551b29de7d28f4fea3a46cc2a4e6 (diff)
downloadskyhanni-092a29dd8b13c2b04b0b7c259446ab697201dd5e.tar.gz
skyhanni-092a29dd8b13c2b04b0b7c259446ab697201dd5e.tar.bz2
skyhanni-092a29dd8b13c2b04b0b7c259446ab697201dd5e.zip
Backend: Dekekt (#2547)
Co-authored-by: Linnea Gräf <nea@nea.moe> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: Cal <cwolfson58@gmail.com>
Diffstat (limited to 'build.gradle.kts')
-rw-r--r--build.gradle.kts56
1 files changed, 34 insertions, 22 deletions
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<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
+}*/