Quality gate has not been computed for project -Error

Hi Team,

We are getting the below error message while scan my bitbucket source.

Status: Downloaded newer image for sonarsource/sonarcloud-quality-gate:0.1.5

✖ Quality gate has not been computed for project.

my configuration are below,

image: mcr.microsoft.com/dotnet/core/sdk:3.1

image: mcr.microsoft.com/dotnet/sdk:5.0

clone:
depth: full # SonarCloud scanner needs the full history to assign issues properly
addons:
sonarcloud:
organization: “sonarcloud”
token:
secure: “j21c797ea979954bd4a5fd66f8bf6209fb476e18e”

pipelines:
default:
- step:
caches:
- dotnetcore
script:
- dotnet restore
- dotnet build
- pipe: sonarsource/sonarcloud-scan:1.4.0
- pipe: sonarsource/sonarcloud-quality-gate:0.1.5

What do you see in SonarCloud related to your project’s Quality Gate?

I have set a new code definition. Now it is running fine. But they executed 0 Lines of Code.

Dotnet core project

You won’t be able to use the sonarcloud-scan pipe for a .NET project, as you need to use the Scanner for .NET.

You might take some inspiration from another user who configured this:

Hi,

Thanks for the detail.

In the given sample code, only a sonar scan is available.
Sonar quality gate is not configured (sonarcloud-quality-gate) in that example. Do we need to add any code for sonar quality gate ? Or the above code covers both sonar scan and sonar quality gate ?

You can add /d:sonar.qualitygate.wait=true as an analysis parameter to fail the pipeline if your Quality Gate fails. You cannot use the sonarcloud-quality-gate pipe in this context.

Thanks.
The below format is correct? or we need add with double quote( /d:“sonar.qualitygate.wait=true” ) ?

  • dotnet sonarscanner begin /k:“test123” /d:“sonar.login=${SONAR_TOKEN}” /o:“test1” /v:"${BITBUCKET_COMMIT}" /d:sonar.qualitygate.wait=true /d:“sonar.host.url=https://sonarcloud.io”

You’re probably safe adding the quotation marks to match the rest of your parameters – but don’t take my word for it. The best thing you can do is… try it!

Thanks. It is working fine.

Hi ,

My scan result showing Coverage 0% and HotSpot 0%.

Any script or property need to add ?