Code analysis on .bicep (Azure Resource Manager)

Hello,

I tried to setup SonarCloud on an infra-as-code project using Azure Resource Manager (.bicep).
When running the code analysis (with the SonarCloudAnalyze task on Azure DevOps), the task is unable to parse some of them.
After analyzing the issue, it turns out that it doesn’t support the nullable operator (?) in the type definition of parameters.
What are my options to make it work?

Hey @Boris-Mozzaik

This should have been fixed and deployed to SonarQube Cloud. (SONARIAC-1793)

Can you share an example of a file that fails to parse on the nullable operator? Maybe we missed something!

Hi Colin,

Thank you for your reply.
Sure, here are the errors I get in the pipeline:

Here are the mentioned files in respective order:

src/application/application-subscription.bicep:

src/key-vault/access-policies/add-access-policies.bicep

src/application/application.bicep
(I can only put 4 pictures, so I’ll put the 3rd one in another message)

Also, here are the tasks that I use:

  steps:
    - task: SonarCloudPrepare@3
      displayName: 'Prepare analysis on SonarCloud'
      inputs:
        SonarCloud: SonarCloud
        organization: $(organizationName)
        scannerMode: CLI
        configMode: manual
        cliProjectKey: $(organizationName)_$(Build.Repository.Name)
        cliProjectName: $(Build.Repository.Name)
        cliProjectVersion: '1.0.0'
        cliSources: 'src'

    - task: SonarCloudAnalyze@3
      displayName: 'Run Code Analysis'
      inputs:
        jdkversion: 'JAVA_HOME_21_X64'

    - task: SonarCloudPublish@3
      displayName: 'Publish Quality Gate Result'
      inputs:
        pollingTimeoutSec: '300'

src/application/application.bicep

I even tried to use the last version of the scanner CLI but I still get the same errors unfortunately.