autonomousapps / dependency-analysis-gradle-plugin

Gradle plugin for JVM projects written in Java, Kotlin, Groovy, or Scala; and Android projects written in Java or Kotlin. Provides advice for managing dependencies and other applied plugins
Apache License 2.0
1.8k stars 119 forks source link

Used transitive dependencies advice for test dependencies suggests wrong configuration #424

Closed gabrielittner closed 3 years ago

gabrielittner commented 3 years ago

Build scan link

transitive-test.zip

Plugin version

0.74.0

Gradle version

7.0

(Optional) Android Gradle Plugin (AGP) version

4.2.1

Describe the bug

I'm depending on io.kotest:kotest-assertions-core-jvm in testImplementation but only use things from the transitive io.kotest:kotest-assertions-shared-jvm dependency. I correctly get the advice to remove the former, but the suggestion to add the latter directly tells me to add it using implementation instead of testImplementation.

Advice for project :settings
Unused dependencies which should be removed:
- testImplementation("io.kotest:kotest-assertions-core-jvm:4.6.0")

Transitively used dependencies that should be declared directly as indicated:
- implementation("io.kotest:kotest-assertions-shared-jvm:4.6.0")

To Reproduce Steps to reproduce the behavior:

See above or sample project.

Expected behavior

The advice should be

Advice for project :settings
Unused dependencies which should be removed:
- testImplementation("io.kotest:kotest-assertions-core-jvm:4.6.0")

Transitively used dependencies that should be declared directly as indicated:
- testImplementation("io.kotest:kotest-assertions-shared-jvm:4.6.0")
autonomousapps commented 3 years ago

The fix for this will be published with the next release. You can already verify by using the latest snapshot (once it gets published).