Hello, we’re trying to use SonarCloud on a very large solution (over 100 projects) and integrate it into Azure Pipelines to integrate with PRs in Azure DevOps.
Without SonarCloud, the build of the solution (MSBuild /t:Build) is ~8 minutes. But when we add SonarCloud (call the “prepare” pipeline step), the build gets significantly slower to ~24 minutes. That’s because of all the additional analysis that runs as part of the compilation step.
Since we’re using this inside validation builds in PRs, only the code issues found in the changed lines are reported into the PR as comments. But still the entire solution is analyzed and slowed down, not just the changed parts.
Is there some way to make this faster? If the PR validation builds take too long, we cannot use them as it degrades the developer experience too much.
Thank you. This will be useful if I want to get into depth on how to optimize the details.
Since SonarCloud only reports issues for the changed code, is it possible that it would only run analysis on the changed code? Is there some way of achieving that?
We are gradually working towards being able to limit the files that are analyzed in the context of PR analyses (we’ve already done this in SonarQube for languages that don’t require cross-file analysis, and implemented server-side caches for Java and C/C++ which do cross-file analysis).
These changes will eventually make their way to SonarCloud – but still leaves a few languages (mostly our flagship languages, including C#) where this still isn’t possible. Additionally, analysis of C# is done in such as specific manner (using Roslyn analyzers executed at build-time) that I’m sure there will be some additional complexity (if it’s possible at all).
So right now, the only thing you can do is focus on the optimizations described by @Andrei_Epure and that are found in the performance guide.