VSTS Task Prepare Analysis ignore "Additional Properties" for exclusions


(Ousmane Barry) #1


I’m using the VTS Task version 4 and the properties set in Additional Properties from task Prepare analysis on SonarQure are ignored by the Run code analysis. The properties are detected but the files to be ignored are analyzed.

SonarQube Version 5.6.6
SonarScanner for MSBuild 4.3.1
VSTS Task: Prepare analysis on SonarQube version 4.3.2

(Nicolas Bontoux) #2

Hi there,

Well you do see the exclusions in the analysis logs, which means that they’re not really ignored, and do make their way from the task config to the actual analysis.

All in all seems like you need to dig down why the exclusion patterns are actually not effective. A good approach whenever troubleshooting logs is to simply enable debug logs of the analysis, and then compare filepaths:

  • for the file that you expected to be excluded, what is the filepath that is treated during the analysis ?
  • compare that to the exclusion pattern you set, and see if it might relate to some casing/relativity/else

How to exclude files/folders in for .NetCore MSBuild
Problem with sonar.inclusions
(Ousmane Barry) #3

Thanks for your repy. How to enable debug logs of the analysis on VSTS task ?

(Nicolas Bontoux) #4

Generally speaking: sonar.verbose=true analysis parameter (documentation).

Alternatively in VSTS context, I think you can simply set system.debug to true when queuing the build.

(Ousmane Barry) #5

Thank you, it helps a lot. However, I think it’s not working as intented. Please find enclosed the folder structure.


So, if I want to exclude wwwroot folder, I have to enter: sonar.exclusions=wwwroot\**\*
If I set : sonar.exclusions=src\ProjectA\wwwroot\**\* ==> it does not work.

So I have no way to exclude folder TestProjectA et TestProjectB for example.

Is it how the task should behave ?


(Nicolas Bontoux) #6

Hi Ousmane,

With this set of data it’s hard to make any conclusion. As I mentioned:

Let me know your observations there, and do share logs if further questions.

(Ousmane Barry) #7

Where can I securely send you the full logs ?


(Mark Hiscocks) #8

I am encountering the exact same issue: the folder (in this example “Project A”) doesn’t seem to come into play at all.

I enabled debug logs for sonarqube and could see logs like this (slightly edited):

2018-07-31T12:38:22.7037533Z 08:38:22.703 INFO:   **/folder_to_exclude/**/*
2018-07-31T12:38:22.7662526Z 08:38:22.766 DEBUG: 'Packages/Legacy/folder_to_exclude/File.cs' generated metadata  with charset 'UTF-8'
2018-07-31T12:38:22.7818781Z 08:38:22.781 DEBUG: 'File.cs' indexed with language 'cs'

The results for that file are then shown in SonarQube.

(Nicolas Bontoux) #9

Well, keep in mind that this forum is an open/community one. There are shared benefits to work based on generic/minimal reproducers that can be viewed/used by all.

In that spirit, are you (or @mark.hiscocks ) able to reproduce this with a minimal sample project, for which you could share full debug logs here ?