Skip to content
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

Overridden Kotlin compiler version can lead to failures running detekt #4817

Closed
3flex opened this issue May 7, 2022 · 0 comments · Fixed by #4822
Closed

Overridden Kotlin compiler version can lead to failures running detekt #4817

3flex opened this issue May 7, 2022 · 0 comments · Fixed by #4822
Labels

Comments

@3flex
Copy link
Member

3flex commented May 7, 2022

Expected Behavior

Dependencies of detekt-cli cannot be overridden, so that specifying a specific detekt-cli version with the detekt configuration or by specifying toolVersion will always execute using a compatible Kotlin compiler version.

Observed Behavior

It's easy to override the Kotlin dependency (see #4786 (comment)) & #4813 (reply in thread), and this can happen even when users did not intend to affect the behaviour of detekt or alter its dependencies.

Steps to Reproduce

Use detekt 1.20.0, and override the kotlin compiler embeddable dependency using e.g.

configurations.matching { it.name != "detekt" }.all {
    resolutionStrategy.eachDependency {
        if (requested.group == "org.jetbrains.kotlin") {
            useVersion("1.6.10")
        }
    }
}

Context

See #4786. The actual underlying issue is that detekt-cli expects to run using a specific version of org.jetbrains.kotlin:kotlin-compiler-embeddable dependency, but the Kotlin dependency is easy to override leading to unexpected & confusing results for users.

Your Environment

  • Version of detekt used:
  • Version of Gradle used (if applicable):
  • Gradle scan link (add --scan option when running the gradle task):
  • Operating System and version:
  • Link to your project (if it's a public repository):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant