- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
SonarQube 8.6.1 SonarScanner
what are you trying to achieve
I am trying to reduce the time taken to run msbuild with sonarscanner running.
I have run “msbuild /p:reportanalyzer=true”. The profile results identified some projects that were taking a LOT longer to analyse than most projects (> 5 minutes vs < 1 second for most projects).
These projects have code autogenerated by swagger. I want to exclude this autogenerated code from analysis without excluding the whole project.
what have you tried so far to achieve this
I have excluded specific folders using the “sonar.exclusions” setting, from the project settings in sonarqube. What I have noticed is that this setting is working correctly for the post build sonarqube analysis step (i.e. the step that runs when you call “dotnet-sonarscanner.exe end”). The folders are correctly excluded from the analysis.
BUT the excluded files are still being analysed during the msbuild step.
- the profile results returned by “msbuild /p:reportanalyzer=true” have not changed at all
- the msbuild log has entries from sonarqube analysis, showing that those excluded files are being analysed during the build. e.g. warnings about unused local variables etc.
Is this expected behaviour? Should the sonar.exclusions setting effect the msbuild step? Or does it only effect the “dotnet-sonarscanner.exe end” step?
Or am I not applying the settings correctly?
The code exclusion documentation mentions how to excluded files, but doesn’t specify what the files will be excluded from.