Ignoring specific files/folders with sonar.exclusions

I have an ASP.NET MVC5 web app running on an Azure Devops CI/CD pipeline which includes SonarCloud for static code analyses. I am trying to ignore all 3rd party files such as Javascript/JQuery libraries which are throwing up a lot of “Bugs” and “Code Smells”.

I would like to hide these files specifically:

INFO: 4/9 files analyzed, current file: BookingSystem/Scripts/jquery-3.3.1.js

I have tried various sonar.exclusions in Administration > General Settings > Analysis Scope > Files > Source File Exclusions and none have hidden the specific folders:

sonar.exclusions=**\Scripts\**
sonar.exclusions=Scripts\**
sonar.exclusions=**\Scripts**
sonar.exclusions=**\BookingSystem\Scripts\**

picture of logs:

Can anyone tell me which format to use please?

Hi @craig19 and welcome to the community !

Can you try with forward slashes instead of back ones ?

Mickaël

Hi @mickaelcaro. I am having a similar issue; specifically I am trying to exclude migration files from analysis.

My main issue is that I can’t figure out how to test my exclusion BEFORE merging my changes back to the main branch.

My questions are:

  1. What is the exact format that exclusions should be written in?

  2. How can I test it while my changes are still local?

Thank you!