- Azure DevOps
- C#
I started analyzing a new project and everything seems to be working fine and I can see the results in SonarCloud, however the PR is not being annotated. The Status Check is enabled as required on the branch policies and the quality gate is reporting a failure on SC (as expected) but the PR can still be integrated.
Here’s the yaml to prepare the analysis
- task: SonarCloudPrepare@1
displayName: 'Prepare analysis on SonarCloud'
condition: eq('${{ parameters.RunSonarCloudScan }}', true)
inputs:
SonarCloud: SonarCloud
organization: '$(SonarCloudOrganizationKey)'
projectKey: '$(SonarCloudProjectKey)'
projectName: '$(SonarCloudProjectName)'
extraProperties: |
sonar.exclusions=**/obj/**,**/*.dll,**/*.exe,**/*.sql
sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)/**/coverage.opencover.xml
sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/**/*.trx
sonar.projectVersion=1.$(Build.BuildNumber)
sonar.pullrequest.provider=vsts
sonar.pullrequest.vsts.token.secured=**************