runningcode / gradle-doctor

The right prescription for your Gradle build.
http://runningcode.github.io/gradle-doctor
Apache License 2.0
723 stars 46 forks source link

Feature Request: Optionally fail when not using a version catalog to define a dependency #230

Open codefish1 opened 1 year ago

codefish1 commented 1 year ago

Version Catalogs provide the ability to centrally define your dependency versions rather than defining the versions multiple times across various sub projects. This also has the added benefit of easily been able to up-version a dependency using tools like depend-a-bot.

I'd like to see adoption of version catalogs be driven through gradle doctor to encourage this by warning (and optionally failing the build) when it detects that a version has been defined directly within a build.gradle(.kts) file

runningcode commented 7 months ago

How can this be detected? I feel like this is a bit out of scope of the Gradle doctor though.

codefish1 commented 7 months ago

Might be out of scope for Gradle docker in that it won't make your builds faster. Just helps to keep them tider and less errorprone.

We can detect it since you end up with the version number in the string when you defined a dependency.

If the dependency is managed with a BOM there is no version number. The version catalog will import it via an accessor (if I've got the right name for it)