nebula-plugins / gradle-lint-plugin

A pluggable and configurable linter tool for identifying and reporting on patterns of misuse or deprecations in Gradle scripts.
Apache License 2.0
757 stars 88 forks source link

"unused-dependency" rule doesn't work version catalogs #390

Open zman0900 opened 1 year ago

zman0900 commented 1 year ago

When using Gradle's "version catalog" feature to declare dependencies, the "unused-dependency" detector doesn't find problems that it normally would.

With gradle/libs.versions.toml file containing:

[versions]
slf4j = "1.7.36"

[libraries]
slf4j-api = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" }

Nothing is detected when dependency is declared like this on a project that does not use slf4j-api:

dependencies {
    implementation libs.slf4j.api
}

But if dependency is declared like this instead, it is correctly detected as unused:

dependencies {
    implementation 'org.slf4j:slf4j-api:1.7.36'
}
sembozdemir commented 1 year ago

I have the same issue. is there any plan to support version-catalogs?