In Azure DevOps, I did use the provided commands:
dotnet sonarscanner begin \
/o:"wiremock-net" \
/k:"WireMock-Net_WireMock.Net" \
/d:sonar.host.url="https://sonarcloud.io" \
/d:sonar.token="***"
dotnet sonarscanner end /d:sonar.token="***"
However when the analysis is done; this new branch does not show up in sonarcloud.io and it seems that the delta is defined/found in the master branch?
The “stef-1118-yaml” branch is when I still used the SonarCloud Azure DevOps task instead on the the dotnet tool.
github project branch is:
sonar cloud project is:
https://sonarcloud.io/project/overview?id=WireMock-Net_WireMock.Net
Colin
(Colin)
June 20, 2024, 8:51am
2
Hey there.
The Azure DevOps Extension provides the sonar.branch.name
analysis parameter that you won’t get if you just run the raw scanner (you’d have to manually set /d:sonar.branch.name=$(Build.SourceBranchName)
or something like that.
Why did you make the switch, if I can ask?
1 Like
Thanks!
I didn’t try this specific setting. I was mostly looking at Pull Request analysis , however I could not get it to work.
However, according to the documentation (Branch analysis ) it should work automatically?
Scanners can automatically detect branch parameters when running on the following CI services:
Azure Pipelines
. . .
Colin
(Colin)
June 20, 2024, 9:12am
4
The docs assume you’re using the Extension for Azure DevOps and associated tasks.
I tried to make the switch yesterday, but I did revert it on the master.
Now with your suggestion, I’ve implemented this:
- script: |
dotnet sonarscanner begin /k:"WireMock-Net_WireMock.Net" /o:"wiremock-net" /d:sonar.branch.name=$(Build.SourceBranchName) /d:sonar.host.url="https://sonarcloud.io" /d:sonar.token="$(SONAR_TOKEN)" /d:sonar.dotnet.excludeTestProjects=true /d:sonar.cs.opencover.reportsPaths=**/coverage.net8.0.opencover.xml /d:sonar.verbose=true
displayName: 'Begin analysis on SonarCloud'
And this seems to work fine now:
system
(system)
Closed
June 27, 2024, 9:18am
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.