I have upgraded the XML and JS sonar plugins to the latest but the issue is same. As the XML files are wrongly formatted intentionally, i have tried excluding from analysis by adding sonar switch “sonar.exclusions=**/DataAccess.Mock/MockInputFiles/*.xml” but with no luck. The build still fails at the same exact files. Also tried the pattern with exact path of the XML files directory but did not work. Any help here is highly appreciated
And we are also facing the similar issue when trying to include a specific folder for analysis. The patterns I have used is as below. In this case none of the files are considered for the analysis
I asked about which scanner you’re using to understand whether you were explicitly specifying sonar.sources or whether that was read from your build system. If you’re using MSBuild, Maven, or Gradle it will be the latter.
If you are specifying sonar.sources then your first option is just to narrow it to FolderB. If for some reason that’s not practical, your next option is to take another look at your inclusions settings. The real question is whether analysis sees the path to FolderB as starting in FolderA. This is why I asked for anything relevant-seeming from your log; a snippet with a path might have revealed that. Nonetheless, I’d try prepending ‘FolderA’ with **/ as in
We use MSBUILD/VSTS Task where the sonar.source directory will be determined by the build system
We are already using the same exact inclusion pattern that you have mentioned and we are also seeing in the log that the inclusion pattern is applied on the identified source folder. Unfortunately the inclusion pattern ignoring all the files. In the VSTS build console log here is what I see
LogLine-1:
------------------------------------------Scanning “ModuleName” [it seems like each csproj/vbproj is getting considered as an individual module]
How do you specify your inclusion/exclusion? Via the UI? Command-line params? Something else? And is this the only pattern you apply or are there more?
The VSTS/TFS task offers a text box where you can mention the command line parameters like sonar.inclusions/sonar.exclusions. We use the same for including any additional parameters to the scanner
The exclusion pattern that you have provided worked and excluded the intended set of XML files in one of the module. Along with these files it also excluded several other files in few other modules inspite of pattern mismatch. I have thoroughly checked the module content where the exclusions are unintentional but could not find any traces of such files
And regarding exclusion, I want to consider only those projects under specific location as they all logically belong to one single business application and want to see the results under a specific Sonar Project. In MODULE sense, i want to consider modules/MSBUILD projects of specific folder location. To elaborate, all projects/content under “FolderB” folder from the below structure are to be considered