Okay! You filed this under the SonarQube category rather than SonarCloud, which is why I was confused.
Here’s the deal – while the cache works with pull request analysis, it does not work yet with branch analysis.
It works with PR analysis because we only see the files belonging to the PR and the others are discarded. This is what we’re calling “incremental analysis” – and what the cache is designed for today.
For branch analysis this is different: an analysis of the main branch shows the analysis for the entire branch. We haven’t gotten to the point of being able to confidently merge existing analysis results and new analysis results and display that as a new analysis, which would be required for the main branch.
Thus, when you analyze a main branch, all files are ineligible to use the cache.
It’s on the list, but we prioritized PR analysis because developers typically have less time to wait for a PR analysis than for a main branch analysis.
Thanks, Colin, that’s a very exhaustive explanation. It helps
I would even suggest to add it to the documentation, to help people understand what are the use cases of the cache.
Currently Sonar-scanner takes a very long time analysing our project (almost 8 minutes, which starts to be unbearable for the pipeline of our application). I was hoping the cache could help speeding up things, but now I understand this is not possible.
(and sorry for filing it under the wrong category, I was confused. I was actually looking for sonar-scanner and couldn’t find it, so I thought sonarqube was the right one )