We have a project that has a massive 3rd party library in it which eats up hundreds of files and thousands of lines of code. This 3rd party library code is in our wwwroot folder (which has subdirectories for javascript and css files).
I have tried to set the wwwroot file as excluded multiple ways.
In the UI under Project > General Settings > Analysis Scope > Source File Exclusions: **/*MyProjName/Web/wwwroot/**/*
I have also tried other versions of this syntax: **/*MyProjName/Web/wwwroot/**/*.*
and with the key of sonar.exclusions=**/*MyProjName/Web/wwwroot/**/*
I understand that there are global analysis under Administration > Configuration > General Settings > Analysis Scope and I have attempted to duplicate the syntax there under Source File Exclusions.
In the Azure DevOps build definition in the sonarQube prepare task I have:
Notice that I created separate lines for each of my Sonar analysis parameters. You had originally concatenated 2 different parameters into one line, which will not work properly.
I did notice that other folder paths, it seems to pick up and ignore, but with the Web/wwwroot folder path, the exclude acts like it can’t see any files inside the Web folder at all.
Or you can take a screenshot of your project so I understand where the folders are at. You can use a glob tool like this one to test if the exclusion finds the right folder/file path.
I need to exclude everything in wwwroot (the DevExpress library kills our LOC limit). But the paths don’t seem to see anything in the Web folder. I should also add that this is running on a VM server with a self-hosted agent so actual paths are like D:/agent_99/work/r3/…
Problem solved! The exclusion should have been set for sonar.test.exclusions, not sonar.exclusions since the wwwroot/ folder was considered a test source: