Sonar Qube Not Excluding All test file

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension): 9.9.3
  • how is SonarQube deployed: zip, Docker, Helm
  • what are you trying to achieve: Exclude all test files from coverage
  • what have you tried so far to achieve this

Added Exclusions as follows

Excluded sources: **/BlueBay.OTCSecurities.Models/Settings/*.cs, **/Program.cs, **/*.xml, **/*Test*.cs, **/*.bin, **/*.UnitTests/*.*, **/BlueBay.OTCSecurities.Api.UnitTests/*.*, **/BlueBay.OTCSecurities.DataAccess.Models/*.*, **/BlueBay.OTCSecurities.Models/**, **/*test*/**

In above example already have these:-

**/*.UnitTests/*.*
 **/*Test*.cs
**/*test*/**

But still getting many files are showing under code smells:-

INFO: Indexing files of module 'BlueBay.Common.UnitTests'
INFO:   Base dir: D:\agents\01\_work\2561\s\BlueBay.Common.UnitTests
INFO:   Test paths: ExceptionsTests/BadRequestExceptionTests.cs, ExceptionsTests/Fo...

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Any idea why these filters are not working
Thanks
Sunil Bindra

Hi Sunil,

Is this a C# test project?

And is the problem that it’s being analyzed as source code rather than test code or that it’s being analyzed at all?

 
Ann