I am using Bitbucket Cloud to analyze multiple C++ repositories, one of which is the parent/master repo. The rest are submodules within the parent repo. The structure is roughly:
- submoduleB (depends on A)
- submoduleC (depends on A and B)
When I run SonarScanner in the master-repo Bitbucket pipeline, pull request decorations show on the master-repo files that have code smells. However, when I run SonarScanner in the submodules, the pull request decorations do not show and the Sonar widget on the PR always shows no new smells, no bugs, etc. I would like to get SonarScanner running properly in the submodules.
The pipeline steps in the submodule are roughly:
- Start in submoduleC (let’s call this root/submoduleC)
- cd …
- git clone master-repo
- cd master-repo
- init submodules, check out submoduleA, submoduleB, and submoduleC (let’s call this master-repo/submoduleC)
- build repo
- run SonarScanner
I assume the problem is that the checked out master-repo/submoduleC (step 5) does not link back properly to the same root/submoduleC code (step 1) above. I have tried 1. replacing master-repo/submoduleC with a symlink to root/submoduleC and 2. updating master-repo/CMakeLists.txt to point to root/submoduleC instead of master-repo/submoduleC. Neither of these approaches have worked.
Is there a way to run SonarScanner such that the code smells and pull request decorations show up in a submodule build?