Assume a user that wants to make sure that old projects are not bloating his SonarQube instance, so he wants to clean up everything where the latest analysis is older than three months. But he has some projects where short-lived branches are being actively analysed, but the master (which holds the release) isn’t analysed for a period longer than three months.
Quite reasonably, he wants his cleanup mechanism to leave these projects alone since they’re actually active.
- the project management page doesn't take into account analyses on branches
- the analyzedBefore parameter to api/projects/search and api/projects/bulk_delete isn’t branch-aware: it only looks at the analysis date of the main branch.
So the following changes are done with this ticket:
- The analyzedBefore parameter for api/projects/search and api/projects/bulk_delete applies to all branches and PRs, meaning that all analysis in all branches/PRs of the projects returned were done before the date.
- The field lastAnalysisDate in the projects returned is the last analysis date across all branches and PRs of the project
- The field revision is unchanged. It's the revision of the last analysis of the main branch