Our C++ project is around 100K lines of code, and we have a lot of shared code between around 15 build targets. Around 90% of the code is shared, with minor differences (minor features etc.) between build targets.
How can we use SonarCloud/SonarScanner to analyse our code and get a good overview of the code quality? I don’t see a proper way to configure the SonarScanner for C/C++ projects with multiple targets. The documentation is not very clear on this.
We have tried monorepo feature, but every monorepo is getting multiplied with LOC and it gets exceeded the limit.
Will we be able to use this properly in pull requests as quality gates if we use separate branch ? For e.g. if one file is not used in some build targets, will this cause a problem ?
We have a single main branch. So if I understand correctly, you meant to maintain clones of main branch just for the sake of running analysis.
main-target1
main-target2
main-target3
etc.
Now the pull request will be raised only to the main branch (not the clones)… do you mean that when running analysis, i can simply change the target branch to get results of all ??
For target 1:
sonar.pullrequest.key=123
sonar.pullrequest.base=main-target1
sonar.pullrequest.branch=pr_branch
For target2:
sonar.pullrequest.key=123
sonar.pullrequest.base=main-target2
sonar.pullrequest.branch=pr_branch
For target3:
sonar.pullrequest.key=123
sonar.pullrequest.base=main-target3
sonar.pullrequest.branch=pr_branch
I am yet to try this method, I was asking whether we can analyse or check all targets in pull requests like this since the pull request key is same, will the last run overwrite the previous pull request analysis.