Analysis running in Azure Pipeline ignoring file exclusions

vsts
dotnet
(Andre Vianna) #1

I’ve set an Azure pipeline step for SonarQube Cloud.

I’ve added properties for exclusions:
Here is the content of the Additional Properties field:

sonar.exclusions="**/Migrations/**,**/wwwroot/**,**/*.ruleset"
sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml"
sonar.coverage.exclusions="**/Migrations/**,**/*.Tests/**,**/*.TestDoubles/**,**/*.TestHarness/**"

During the analysis, the files in the sonar exclusions are not being excluded.
Here is the extract from the logs of the analysis step:

    2019-03-01T20:00:56.9053195Z INFO: Indexing files of module 'DnD5eTools'
    2019-03-01T20:00:56.9053576Z INFO:   Base dir: D:\a\1\s
    2019-03-01T20:00:56.9053809Z INFO:   Excluded sources: **/Migrations/**,**/wwwroot/**
    2019-03-01T20:00:56.9054099Z INFO:   Excluded sources for coverage: **/Migrations/**,**/*.Tests/**,**/*.TestDoubles/**,**/*.TestHarness/**
    2019-03-01T20:00:56.9054318Z INFO: 1748 files indexed
    2019-03-01T20:00:56.9054523Z INFO: 0 files ignored because of inclusion/exclusion patterns

That is from the remote analysis.

In the local server, the analysis of the same project the files are excluded.
Here is the extract:

    INFO: Indexing files of module 'DnD5eTools-SonarQube'
    INFO:   Base dir: C:\Projects\DnD5eTools
    INFO:   Excluded sources: **/Migrations/**, **/wwwroot/**
    INFO:   Excluded sources for coverage: **/Migrations/**, **/*.Tests/**, **/*.TestDoubles/**, **/*.TestHarness/**
    INFO: 756 files indexed
    INFO: 1280 files ignored because of inclusion/exclusion patterns

Please help me understand what is wrong.

Andre

Here is the generated YAML:

steps:
    - task: SonarSource.sonarcloud.--------------------GUID------------------.SonarCloudPrepare@1
        displayName: 'Prepare analysis on SonarCloud'
        inputs:
        SonarCloud: SonarCloud
        organization: '-------------'
        projectKey: '-----------------------'
        projectName: DnD5eTools
        extraProperties: |
            sonar.exclusions="**/Migrations/**,**/wwwroot/**,**/*.ruleset"
            sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml"
            sonar.coverage.exclusions="**/Migrations/**,**/*.Tests/**,**/*.TestDoubles/**,**/*.TestHarness/**"
(Peter Connor) #2

Did you have any luck with this? We are having this happen for some of our projects too…

(Andre Vianna) #3

No luck at all and no answer from SonarQube also.

(Fabrice Bellingard) #4

Andre, since it seems that this is working on your local server, can you tell us:

  • Which version of SonarQube you are using locally
  • Which version of the SonarQube extension and/or which version of the Scanner for MSBuild you are using locally

This should help us troubleshoot this.