Excluding submodule from analasis

We are running SonarQube a a small c# project.
This project includes an other independent c# project, which acts as a common library/submodule.

How can I ignore thise library project to be scannend/analyzed?

Logfile shows:
|build|03-Sep-2018 14:51:23|INFO: Base dir: D:\bamboo-home\xml-data\build-dir\CP-BB0-COMDISPAPI\common.lib\Infrastructure\StepOne.Infrastructure.Storage.FileSystem|
|—|---|—|
|build|03-Sep-2018 14:51:23|INFO: Working dir: D:\bamboo-home\xml-data\build-dir\CP-BB0-COMDISPAPI.sonarqube\out.sonar\CP_DISP.API_CP_DISP.API_9FC17CE7-33C2-4541-8B4D-32E143DE6532|
|build|03-Sep-2018 14:51:23|INFO: Source paths: FileSystemOptions.cs, FileSystemStorageExtensions.cs, FileSystemStorageProvider.cs, FileSystemStore.cs, Internal/FileSystemFileReference.cs|
|build|03-Sep-2018 14:51:23|INFO: Source encoding: UTF-8, default locale: en_US|
|build|03-Sep-2018 14:51:23|INFO: Index files|
|build|03-Sep-2018 14:51:23|INFO: Excluded sources: |
|build|03-Sep-2018 14:51:23|INFO: StepOne.**|
|build|03-Sep-2018 14:51:23|INFO: 5 files indexed|
|build|03-Sep-2018 14:51:23|INFO: 0 files ignored because of inclusion/exclusion patterns|

Everything below \common.lib belongs to the library project which shouldn’t be scannend.
Thans for helping
Regards
Jörg

Hello,

Excluding a submodule from the analysis can be achieved by modifying the csproj file. You can find it in the documentation.

Greetings,
Alex.

Hi Alex,
Thanks for the feedback.
Is there any other solution ?

We want to analyze the module independently, but if we change the project file, then it will be never analyzed.

Thanks
Jörg

Have a look at this stackoverflow answer that describes how to conditionally exclude a shared project from analysis.

Regards,
Duncan

1 Like

Thanks Duncan.

Is there any chance to reach the target without makeing any changes to the code?
Whant about sonar.exclusions ?

Thanks
Jörg

(reviving and answering an old conversation…)

If you are building and analysing the common code separately and sending the analysis results to a different SonarQube project then yes, you should be able to use sonar.exclusions to ignore the common code when building the project that uses the common code.