Dotnet PR scan always passing, even with bugs

I am trying to integrate sonarqube into our CI pipline.
It seems to work and the master branch is analyzed properly, but the PR scanning always passes even if I add intentional bugs to my PR…

Also, it never reports coverage changes even though I do add them

image

I am using sonarqube 8.9 developer edition and I am running it using google cloud build

Here is my build/test/scan command:

dotnet sonarscanner begin /k:"$PROJECT_KEY" \
  /d:sonar.login="$SONAR_KEY" \
  /d:sonar.host.url="$SONAR_HOST" \
  /d:sonar.cs.opencover.reportsPaths=$TEST_DIR/coverage.opencover.xml \
  /d:sonar.pullrequest.base=master \
  /d:sonar.pullrequest.branch=$BRANCH_NAME \
  /d:sonar.pullrequest.key=$PR_NUMBER
dotnet build Ide/Lim.sln
dotnet test --no-build $TEST_DIR/UnitTests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
dotnet sonarscanner end /d:sonar.login="$SONAR_KEY"

What am I missing?

When I run the analysis locally on my mac, it’s working fine…
I suspect the when I run it on cloudbuild, there is a shallow clone there that might be screwing things up, but I am not sure. tried to do a deep clone there but it didn’t work… still investigating

Hello @Tomer_Amir , welcome to our community and thanks for using our product.

I’ve checked the configuration we are using to run our scan - you can take a look at it using this link.

Feel free to try to align your arguments the way we do it and let me know if that won’t help you.