Branch has no lines of code after project source restructuring with symlinks

Using SonarQube Enterprise Edition Version 8.9.10 (build 61524) and sonar-scanner-

After restructuring an existing project (use shared components via symlinks) it is reported that the branch has no line of code.

Previous C++ project structure:

| MyProject
| | 3rdparty
| | application
| | hw
| | os
| | …
| |

The 3rdparty code was excluded by “Sonar.exclusions=3rdparty/**”
There were no explicite sonar.inclusions or sonar.sources specified.
With this as expected all the code within application, hw, os, … was scanned.

The current C++ project structure has changed to:

| 3rdparty
| component
| | hw
| | os
| | …

| platform
| | MyProject
| | | application
| | | 3rdparty → …/…/…/3rdparty
| | | component
| | | | hw → …/…/…/component/hw
| | | | os → …/…/…/component/os
| | | | …
| | |

With the same settings in now only the code in MyProject/application can be scanned, this is the part which is not invoked by symlinks. The code in hw and os which was scanned before is now no longer visible. The build itself is successful that means the symlinks are correct.

I tried a couple of workarounds with both sonar.sources and sonar.inclusions but nothing worked as expected.
When I specify
even the code in application is no longer visible, there is no line of code in the whole project which can be found.

When I specify
nothing changes.

I have to admit, now I’m a little lost - how can I scan the code behind a symlink?


Hello @hstreidl,

In order to better understand what is going on, could you share the content of the build-wrapper output directory as well as the sonar-scanner output?
I can send you a private message if needed.

Thank you

Hello Amélie,

Thank you for your response. A private message would be great as the build output will be from productive code.

Mit freundlichen Grüßen / Best regards

Hubert Streidl

Building Technologies, Panel Software Fire (BT-FIR/ENG1-Grb)
Bosch Sicherheitssysteme GmbH | Postfach 11 11 | 85626 Grasbrunn | GERMANY |
Tel. +49 89 6290-1447 | Telefax +49 89 6290-281447 |

Sitz: Stuttgart, Registergericht: Amtsgericht Stuttgart HRB 23118
Aufsichtsratsvorsitzender: Christian Fischer; Geschäftsführung: Thomas Quante, Peter Löffler, Henrik Siegle


While reading the jenkins log, we can see your source files are excluded because of the scm ignore settings (which is confirmed by setting sonar.scm.exclusions.disabled to true).
lines such as:

07:54:03.342 DEBUG: File '/net/si0vmc3847/fs0/var/lib/jenkins/workspace/ature_sth-b-sample-config-update/application/minimalmodule/component/os/threadx/public/osimpl/threadimpl.h' is excluded by the scm ignore settings.

point to it, however I suspect the error comes from the interaction between what’s ignored by the SCM and the symlinks in your project.
I have trouble matching the logs with the project structure you explained earlier, It would help a lot if you could provide us a skeleton example that could reproduce your issue. Thanks!