Hello,
I have a CI with Github Action that use dotnet-sonarscanner.
I have some unit test that uses assets like sample json, html, … I don’t want to analyse these files because they are not part of the project but externals samples.
I’m unable to get these file excluded from analyses, this make me crazy !
Do you have any idea of what I’m doing wrong ?
Thanks !
Here is the sonar scanner command :
./.sonar/scanner/dotnet-sonarscanner begin /k:"wavenet-be_******" /o:"wavenet-be" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.projectBaseDir="${{ github.workspace }}" /d:sonar.scm.provider=git /d:sonar.cs.opencover.reportsPaths="src/Project/**/TestResults/**/coverage.opencover.xml" -d:sonar.cs.vstest.reportsPaths="src/Project/**/TestResults/*.trx" /v:${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
dotnet build ./src/Project
dotnet test ./src/Project--logger trx --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
(Also tested with the task highbyte/sonarscan-dotnet, same issue)
I have setup the source exclusions :
And the exclusions is being retrieved by sonar scanner :
INFO: Load project repositories
INFO: Load project repositories (done) | time=165ms
INFO: SCM collecting changed files in the branch
INFO: SCM collecting changed files in the branch (done) | time=160ms
INFO: Indexing files...
INFO: Project configuration:
INFO: Excluded sources: **/build-wrapper-dump.json, src/Project/Wavenet.ProjectSolution.Application.Tests/Assets/**/*.*, **/Assets/**
INFO: Excluded sources for coverage: **/Wavenet.ProjectSolution.Functions/**/*, **/Wavenet.ProjectSolution/Domain/**, **/Wavenet.ProjectSolution/Infrastructure/**
INFO: Indexing files of module 'Wavenet.ProjectSolution.Functions'
INFO: Base dir: /home/runner/work/client-project/client-project/src/Scrapper/Wavenet.ProjectSolution.Functions
INFO: Source paths: ...
INFO: Excluded sources: **/build-wrapper-dump.json, src/Scrapper/Wavenet.ProjectSolution.Application.Tests/Assets/**/*.*, **/Assets/**
INFO: Excluded sources for coverage: **/Wavenet.ProjectSolution.Functions/**/*, **/Wavenet.ProjectSolution/Domain/**, **/Wavenet.ProjectSolution/Infrastructure/**
INFO: Indexing files of module 'Wavenet.ProjectSolution'
INFO: Base dir: /home/runner/work/client-project/client-project/src/Scrapper/Wavenet.ProjectSolution
INFO: Source paths: ...
INFO: Excluded sources: **/build-wrapper-dump.json, src/Scrapper/Wavenet.ProjectSolution.Application.Tests/Assets/**/*.*, **/Assets/**
INFO: Excluded sources for coverage: **/Wavenet.ProjectSolution.Functions/**/*, **/Wavenet.ProjectSolution/Domain/**, **/Wavenet.ProjectSolution/Infrastructure/**
INFO: Indexing files of module 'Wavenet.ProjectSolution.Application.Tests'
INFO: Base dir: /home/runner/work/client-project/client-project/src/Scrapper/Wavenet.ProjectSolution.Application.Tests
INFO: Test paths: CollectorSquare/Queries/GetCollectorSquareBagsPagesToScrapHandl...
INFO: Excluded sources: **/build-wrapper-dump.json, src/Scrapper/Wavenet.ProjectSolution.Application.Tests/Assets/**/*.*, **/Assets/**
INFO: Excluded sources for coverage: **/Wavenet.ProjectSolution.Functions/**/*, **/Wavenet.ProjectSolution/Domain/**, **/Wavenet.ProjectSolution/Infrastructure/**
INFO: Indexing files of module 'wavenet-be_client-project-scrapper'
INFO: Base dir: /home/runner/work/client-project/client-project
INFO: Excluded sources: **/build-wrapper-dump.json, src/Scrapper/Wavenet.ProjectSolution.Application.Tests/Assets/**/*.*, **/Assets/**
INFO: Excluded sources for coverage: **/Wavenet.ProjectSolution.Functions/**/*, **/Wavenet.ProjectSolution/Domain/**, **/Wavenet.ProjectSolution/Infrastructure/**
INFO: 92 files indexed
INFO: Quality profile for cs: Sonar way
INFO: Quality profile for json: Sonar way
INFO: Quality profile for web: Sonar way
But … sonarcloud continue to show errors from these files …
Any idea ?
I would buy a coffee or a beer to someone who point out my mistakes