Konsist is so helpful in a world where AI just won...
# konsist
s
Konsist is so helpful in a world where AI just won't respect rules in the AGENTS.md 👍
Copy code
/**
 * java.io.File is forbidden. We must use kotlinx-io.
 */
@Test
fun testNoJavaIoFileUsage() {

    val violatingFiles = Konsist
        .scopeFromProject()
        .classes()
        .filter { klass ->
            klass.containingFile
                .imports
                .any { it.name.startsWith("java.io.") }
        }

    assertTrue(
        violatingFiles.isEmpty(),
        "Forbidden import detected: ${violatingFiles.map { it.name }}"
    )
}
💯 4
😮 2