I've created a test console app using .net core 3.1, added it to github, and setup a GitHub action using the template provided by Sonarcloud.io.
The build analysis part looks like this:
.\.sonar\scanner\dotnet-sonarscanner begin /k:"<projectkey>" /o:"<org>" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.scanner.force-deprecated-java-version=true
dotnet build --configuration Release --no-restore
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
This builds fine and reports no errors. Yet when I go to sonarcloud.io although I can see it's received the analysis, it's not showing any issues, despite my purposely adding some:
The master branch displays this:
Yet, the code is visible in the code tab:
For PRs I see:
But there are issues (I can see them locally when using SonarLint pointing at sonarcloud.io).
What am I missing?
It turns out this wasn't showing any issues because it was considering all my files as test code. I had created this whole repo as a Sonarcloud test, and my project was called SonarCloudTest.csproj
and Sonar has some regex rules around categorising code.