gradle-lint-plugin
gradle-lint-plugin copied to clipboard
Rule `all-dependency` fails when applied on Kotlin module with no `stdlib` usages
Currently, the Kotlin plugin adds the dependency org.jetbrains.kotlin:kotlin-stdlib:$version automatically to Kotlin modules.
This dependency is added in the configurations $DependenciesMetadata (e.g. implementationDependenciesMetadata, apiDependenciesMetadata) and not in implementation and api.
Running ./gradlew generateGradleLintReport with the rule all-dependency, fails on Kotlin modules which are not using directly standard library APIs.
The violations on those modules are the following:
Violation: Rule=unused-dependency P=1 Line=null Msg=[one or more classes in org.jetbrains.kotlin:kotlin-stdlib:1.8.0 are required by your code directly]
Violation: Rule=undeclared-dependency P=1 Line=null Msg=[one or more classes in org.jetbrains.kotlin:kotlin-stdlib:1.8.0 are required by your code directly]
Proposals which would probably fix this:
- query the
$DependenciesMetadataconfigs internally - expose an API in
GradleLintExtensionto exclude dependencies fromall-dependencychecks (e.g.gradleLint.skipDependencies = "org.jetbrains.kotlin:kotlin-stdlib")