-
-
Notifications
You must be signed in to change notification settings - Fork 757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
detekt 1.22.0 no longer works with kotlin <1.7 #5551
Comments
Without a build scan link I can't confirm, but I suspect the Kotlin version that detekt uses (which can be different to the project's Kotlin version) is being inadvertently overridden. Please see #5021 (comment) and the following comments and see if this helps you. |
I encountered the same issue. I added the dependency override mentioned in #5021 and still see the same issue. The scan is:
|
@tanadeau that shows exactly what I'm describing. The Kotlin version expected by detekt is being overridden by something in your Gradle config. detekt has its own Gradle configuration for its dependencies which will work when they're not overridden. |
Does this count? https://detekt.dev/docs/next/introduction/compatibility#tool-versions Maybe it could be improved to be more explicit? |
@TWiStErRob oh thanks for the pointer! I didn't know about it. I think this deserves a callout in the chart and/or changelog, something like "detekt 1.22 requires kotlin 1.7", as all the existing wording is optional. |
@cortinico can we change the changelog? I agree that the table is not expressive, because some of those are hard requirements, some are just "we tested with" compatibility suggestions. |
Just remember that while detekt needs to use a specific version of Kotlin, that doesn't mean the project it's applied to has to use that same version. It's perfectly fine for a project to use Kotlin 1.8.0 while detekt is using Kotlin 1.7.21 for example. Things only break when detekt's configuration is overridden. So if the changelog or readme is updated it should try to make that clear. Maybe what we can do is put a note at the top of the changelog for each release saying that detekt uses Kotlin x.y.z and that version shouldn't be overridden, with a link to docs explaining how that issue can be spotted and what to do about it. |
Yeah, something like "Note: if you override kotlin version for detekt, this version of detekt no longer works with kotlin 1.6.*." BTW, I just tested that kotlin 1.7.10 would also work. And based on the kotlin change history, I'm guessing 1.7.0 should be fine, too. |
Expected Behavior
detekt 1.22.0 continues to work with projects using kotlin 1.6.21, as the doc doesn't mention kotlin 1.7 as a requirement.
Observed Behavior
Steps to Reproduce
Context
detekt calls https://cs.github.com/JetBrains/kotlin/blob/b6481ed891a35d5f148209a9666462b5248046e3/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/config/JvmContentRoots.kt#L91 which does not seem to exist in kotlin 1.6: https://github.com/JetBrains/kotlin/blob/1.6.20/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/config/JvmContentRoots.kt
Your Environment
The text was updated successfully, but these errors were encountered: