How can I verify if a file contains a valid Kotlin...
# getting-started
i
How can I verify if a file contains a valid Kotlin code (ideally for given Kotlin version)? 🤔
r
Compile it
👍 3
t
Depending on the platform you're targeting, you might be able to do it like they do in Detekt, using a ScriptingEngine: https://github.com/detekt/detekt/blob/221d701d1e7c9755619afc00c0a8e82b02229a4f/det[…]c/main/kotlin/io/github/detekt/test/utils/KotlinScriptEngine.kt
a
to compile code via a REST API there’s the kotlin-compiler-server