Excluding submodule from analasis

dotnet
exclusions
sonarqube
csharp

(Jörg Lang) #1

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


(Alexandre Frigout) #2

Hello,

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

Greetings,
Alex.


(Jörg Lang) #3

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


(Duncan Pocklington) #4

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

Regards,
Duncan


(Jörg Lang) #5

Thanks Duncan.

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

Thanks
Jörg