mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-05 19:08:23 +00:00
Android Studio's "Long overload to Duration conversion" inspection (ConvertLongToDurationInspection) only runs inside the IDE, so its findings never fail ./gradlew lint. Port it as a custom lint check in a new lint-rules module: calls to the kotlinx.coroutines timing functions (delay, withTimeout, debounce, ...) are flagged when the time argument is a Long/Int rather than a kotlin.time.Duration. Overloads cannot be told apart at the JVM level (Duration is a value class backed by long), so the check classifies the argument's Kotlin type via the bundled K2 analysis API. With warningsAsErrors already enabled, the pre-commit/pre-push hooks and CI now fail on any new legacy-Long call site. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ho6LW6eEBkVnnpFvr5tvpi
25 lines
530 B
Kotlin
25 lines
530 B
Kotlin
plugins {
|
|
// No version: AGP's built-in Kotlin already puts the plugin on the build classpath
|
|
id("org.jetbrains.kotlin.jvm")
|
|
alias(libs.plugins.gradle.ktlint) version libs.versions.ktlint.get()
|
|
}
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_21
|
|
targetCompatibility = JavaVersion.VERSION_21
|
|
}
|
|
|
|
kotlin {
|
|
jvmToolchain(21)
|
|
}
|
|
|
|
dependencies {
|
|
compileOnly(libs.lint.api)
|
|
}
|
|
|
|
tasks.jar {
|
|
manifest {
|
|
attributes("Lint-Registry-v2" to "com.greenart7c3.nostrsigner.lint.AmberIssueRegistry")
|
|
}
|
|
}
|