Analysis running in Azure Pipeline ignoring file exclusions

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:


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.


Here is the generated YAML:

    - task: SonarSource.sonarcloud.--------------------GUID------------------.SonarCloudPrepare@1
        displayName: 'Prepare analysis on SonarCloud'
        SonarCloud: SonarCloud
        organization: '-------------'
        projectKey: '-----------------------'
        projectName: DnD5eTools
        extraProperties: |

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

No luck at all and no answer from SonarQube also.

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.

has anyone been able to configure exclusions on Azure Pipelines? i am getting the same issue where files are not being ignored :frowning:

What properties are you setting?

As an example, I excluded all .css files from analysis in an Azure DevOps pipeline by setting the following exclusion in the Prepare Analysis step:


You can compare the results on SonarCloud:
Analysis with exclusions
Analysis without exclusions

If you want to exclude entire directories, the docs suggest that the exclusion pattern needs to end with /*

**/Migrations/* rather than **/Migrations/**

1 Like

A post was split to a new topic: Exclusions in Azure Pipelines