autonomousapps / gradle-best-practices-plugin

Gradle Plugin that detects violations of Gradle best practices in Gradle Plugins
Apache License 2.0
181 stars 3 forks source link

Detect methods that locate and return another project #1

Closed 3flex closed 8 months ago

3flex commented 2 years ago

These are similar in nature to subprojects/allprojects: allowing one project to access and/or configure another.

There are three project methods that facilitate this: https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html#project-java.lang.String-

3flex commented 2 years ago

There's also findProject which I think is similar.

Then there are less risky but similar methods that return project instances that should probably be flagged e.g. getChildProjects, getParent.

3flex commented 2 years ago

I just saw this: https://github.com/gradle/gradle/issues/21485

Looks like Gradle core will have a feature to warn on these calls when isolated builds are used, so there might be crossover with this plugin in terms of functionality.

3flex commented 8 months ago

With the work on isolated projects that's happening in Gradle itself, there will be no need to introduce this feature in this plugin. Running Gradle with isolated projects enabled will report on any prohibited cross project configuration.