SonarScanner for MS Build does not report the number of files ignored

When running the Scanner through the command prompt, the report of number of files ignored always shows 0. I would expect this number to go up as files are excluded.

Using: SonarQube 7.9.1
SonarScanner for MSBuild 4.6.2

Steps to Reproduce:
1)Run scan on project with no Exclusions, review output:
INFO: 191 Files indexed
INFO: 0 files ignored because of inclusion/exclusion patterns

2)Add Exclusions, re-run scan
INFO: 149 files indexed
INFO: 0 files ignored because of inclusion/exclusion patterns

It does exclude the files correctly, it just does not report on the number of files excluded correctly.

Thanks

1 Like

Upgraded to latest versions, SonarQube 8.0 and MSBuild 4.7.1.231.

Issue still happens:
INFO: 0 files ignored because of inclusion/exclusion patterns

1 Like

Can confirm, just tested it.

SonarQube version: 7.9.1
dotnet-sonarscanner version: 4.8.0

Hi,

In which way do you exclude files ?

Thanks.

Mickaël

Hey Mickaël,

personally, I used the GUI from SonarQube to exlude those files as described here by @ganncamp.

So Project View --> Administration --> General Settings --> Analysis Scope --> Source File Exclusions

Cheers,

Robin

I was using both the global file exclusions and project level exclusions from the Web GUI.

Thanks @RobCo and @AndrewC75

We’ve opened https://github.com/SonarSource/sonar-dotnet/issues/2822 to track this issue

Could you please share the exclusion expression you are using?

1 Like

Could you please share the exclusion expression you are using?

Sure, no problem. Since I just wanted to confirm the report of @AndrewC75 I just excluded an entire source directory. So the expression was “${source directory}/*”.

Cheers,
Robin

1 Like

I wanted to exclude some of the javascript libraries in the project because of too many false positives on these libraries.

I used the following exclusion expressions (sonar.global.exclusions):

**/*bootstrap*
**/*jquery*
**/*popper*

As well as these on the project (sonar.exclusions):

JDEUtilities.Documents\*
1 Like