- ALM used: Azure DevOps
- CI system used Azure DevOps
- Languages of the repository: mainly C#/.NET
Hi, I’m currently trying to integrate SonarCloud into our Azure DevOps project. So far, I have a working YAML pipeline which runs in my test pull request and analyzes the code. This is working and I also see the PR with the analysis result in SonarCloud.
What doesn’t work is the PR decoration. The SonarCloud Azure DevOps PAT has the Code read/write permissions and we can see the PR when logging in with that user so that shouldn’t be the issue. There are also no errors in the pipeline.
From my understanding, SonarCloud should always add a comment to the PR, even when there are no code changes, is that correct? I’m asking because that PR doesn’t have any code changes, it only adds the YAML pipeline to the repository.
These are the SonarCloud tasks we’re using in the pipeline:
...
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'SonarCloud (build)'
organization: 'xxx'
scannerMode: 'MSBuild'
projectKey: 'xxx'
projectName: 'xxx'
- task: VSBuild@1
...
- task: VSTest@2
...
- task: SonarCloudAnalyze@1
displayName: 'Run Code Analysis'
- task: SonarCloudPublish@1
displayName: 'Publish Quality Gate Result'
...
Any hints are appreciated.