New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detekt Gradle Task Is Not Remote Gradle Cache Friendly #7170
Comments
I think that to be able to implement this we will need #6879. With that we could split the task in two. One with the analysis (that is the heavy part) and it should be cacheable and another(s) task(s) with the report creation. That last one would not be cacheable because it would depend on the absolute path but it should be a really fast. |
What are your thoughts of accepting a relative path (relative to the module path)? Then the implementation would do something like: I imagine that's the usual use-case and would allow everything to be cacheable. Alternatively, I think this could be solved by accepting a File instead of a string and marking it with |
Here's my concrete proposal that should be mostly backwards compatible:
|
Expected Behavior
It should be possible to configure the detekt tasks in such a way as they can be cached in CI or one machine and then get a cache hit on another machine where the code lives under a different path while not breaking any functionality.
Observed Behavior
It is not possible to use the gradle remote cache without breaking the basePath functionality since the base path, at least from the documentation, takes an absolute path which will differ on different machines which will then result in different task cache keys and therefore cache misses.
Steps to Reproduce
Run detekt on two machines where the module has different paths on the file system. If you have the gradle remote cache enabled, you will notice that there is a cache miss and different cache keys for the two runs due ti the different basePath values.
The only way I've found to make it work is to pass "" as the basePath, but then we get non-relativized paths in the generated reports.
Context
It's nice to allow developers and CI builds to leverage a shared cache.
Your Environment
--scan
option when running the gradle task):The text was updated successfully, but these errors were encountered: