Gradle rules #5494
Replies: 3 comments 1 reply
-
In my opinion, it makes sense to include a Gradle ruleset in detekt. |
Beta Was this translation helpful? Give feedback.
-
That's a great idea. Perhaps we can get inspired by some of rules from: |
Beta Was this translation helpful? Give feedback.
-
It's a good idea, but before duplicating effort, take a look at https://github.com/autonomousapps/gradle-best-practices-plugin. It already has some checks for The author of this plugin also wrote the popular dependency analysis plugin (https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin). |
Beta Was this translation helpful? Give feedback.
-
Gradle has a lot of foot gun apis. An example:
TaskContainer.create
instead ofTaskContainer.register
. And a lot of special ways to declare things.I think that detekt should be able to help to write better gradle code (plugins and scripts). But I'm not sure how. Probably with a configuration of forbidden method call a lot of use cases would be solved. But it's difficult to share configurations. Other option is a first/third party plugin with a copy of forbidden method call and its own default values. Easier to share.
But we would still have another issue. Our gradle plugin doesn't have a task to check the gradle scripts. That's a problem because Forbidden method call needs type solving. The work around would be to use the cli. But it's difficult to configure.
Should we create issues to track the different stoppers? Does it have sense to use detekt for this? Are there other options out there? (I did a little research and found nothing)
Beta Was this translation helpful? Give feedback.
All reactions