Repo created

This commit is contained in:
Fr4nz D13trich 2025-11-22 13:56:56 +01:00
parent 75dc487a7a
commit 39c29d175b
6317 changed files with 388324 additions and 2 deletions

View file

@ -0,0 +1,12 @@
plugins {
id("org.jetbrains.kotlin.jvm")
}
kotlin {
jvmToolchain(11)
}
dependencies {
testImplementation(libs.konsist)
testImplementation(libs.kotlin.test)
}

View file

@ -0,0 +1,6 @@
package net.thunderbird.quality
import com.lemonappdev.konsist.api.Konsist
val projectScope = Konsist.scopeFromProject()
val testScope = Konsist.scopeFromTest()

View file

@ -0,0 +1,40 @@
package net.thunderbird.quality
import com.lemonappdev.konsist.api.verify.assertFalse
import kotlin.test.Test
class ValidateLogger {
@Test
fun `no class should use Java util logging`() {
projectScope.files
.assertFalse(
additionalMessage = "No class should use java.util.logging import, use net.thunderbird.core.logging.Logger instead."
) { it.hasImport { import -> import.name == "java.util.logging.." } }
}
@Test
fun `no class should use Android util logging`() {
projectScope.files
.filterNot { it.hasNameMatching("ConsoleLogSinkTest.android".toRegex()) }
.assertFalse(
additionalMessage = "No class should use android.util.Log import, use net.thunderbird.core.logging.Logger instead."
) {
it.hasImport { import -> import.name == "android.util.Log" }
}
}
@Test
fun `no class should use Timber logging`() {
projectScope.files
.filterNot { it.hasNameMatching("ConsoleLogSink.android|ConsoleLogSinkTest.android".toRegex()) }
.filterNot {
// Exclude legacy code that still uses Timber
it.hasNameMatching("LogFileWriter|FileLoggerTree|K9|DebugLogConfigurator".toRegex())
}
.assertFalse(
additionalMessage = "No class should use timber.log.Timber import, use net.thunderbird.core.logging.Logger instead."
) { it.hasImport { import -> import.name == "timber.log.Timber" } }
}
}