Dotnet scanner multi-language to include IaC support

The 9.x update enabled multi-language support to the dotnet runner so we can scan other code in git repo including files not included in the dotnet solution / project files; except it appears to be a limited subset of supported languages based on file extension in AdditionalFileServices.cs

The dotnet scanner does include analysis of IaC languages, and the sonar.sources discovered and included all .json and .yml files in the git repo but fails to include all file extensions required by the IaC analyzers.

As an engineer with infra as code and application code that go together in same git repo, I want to change the dotnet runner to (optionally?) include all sonar supported languages rather than a subset, so that I dont need to run multiple analysis (a cli runner analysis and a dotnet runner analysis) for every project.

Using SonarScanner for MSBuild 9.0.1 (via AzureDevOps task 7.0.3)

Expected (when using the cli runner):

00:56:53.209 INFO  Sensor IaC AzureResourceManager Sensor [iac]
00:56:53.209 DEBUG File without identifier 'https://schema.management.azure.com/schemas/': apim/api-declaration.json
00:56:53.287 DEBUG 'bicep/azuredeploy-apim.bicep' generated metadata with charset 'UTF-8'
00:56:53.288 INFO  5 source files to be analyzed
00:56:53.344 DEBUG 'bicep/azuredeploy-appsettings.bicep' generated metadata with charset 'UTF-8'
00:56:53.396 DEBUG 'bicep/azuredeploy-data.bicep' generated metadata with charset 'UTF-8'
00:56:53.581 DEBUG 'bicep/azuredeploy-availability.bicep' generated metadata with charset 'UTF-8'
00:56:53.609 DEBUG 'bicep/azuredeploy-compute.bicep' generated metadata with charset 'UTF-8'
00:56:53.709 INFO  5/5 source files have been analyzed
00:56:53.709 INFO  Sensor IaC AzureResourceManager Sensor [iac] (done) | time=508ms

Actual dotnet runner:

sonar.projectBaseDir=/home/vsts/work/1/s
sonar.sources=\
... (includes list of .json, .yml and .cs files)
00:59:08.295 INFO: Sensor IaC AzureResourceManager Sensor [iac]
00:59:08.296 DEBUG: File without identifier 'https://schema.management.azure.com/schemas/': apim/api-declaration.json
00:59:08.297 INFO: 0 source files to be analyzed
00:59:08.297 INFO: 0/0 source files have been analyzed
00:59:08.297 INFO: Sensor IaC AzureResourceManager Sensor [iac] (done) | time=2ms

Hi there, @mikejonestechno , welcome to the community!

We are aware that not all languages are covered yet, and they will come in the near future. IaC languages are on the top of our list, as you can imagine. So is Python. We are also considering supporting C/C++ on SonarQube Server when Autoconfig is available.
We will post an announcement as soon as we add new languages.

Denis

1 Like