Quality_gate_details metric missing conditions

Hi Team,

When a project measure is displayed as “–” in the SonarQube web interface, the /api/measures/component?component=xxx&metricKeys=quality_gate_details returned JSON won’t display the quality gate condition for that measure.

In the attached screenshots, the Coverage On New Code is less than 80.0% condition is not returned in the JSON text. It is a problem, because it seems that the condition is not included in the quality gate.



The JSON text should include all the quality gate conditions, even those which value is “–” (undefined or not computable).

Thanks in advance.

Best regards.

Hey,

In this situation, the condition on coverage is not returned because there are no coverage data available. In this case, the Quality Gate criteria on coverage is not taken into consideration to fail the quality gate, and that’s the reason why it’s not returned by the measure API. there is no coverage measure.

If you are trying to retrieve the quality gate criteria, you can use api/qualitygates/show, which returns the conditions on a specific quality gate:

{
  "id": 5,
  "name": "My Quality Gate",
  "conditions": [
    {
      "id": "AU-Tpxb--iU5OvuD2FLy",
      "metric": "blocker_violations",
      "op": "GT",
      "error": "0"
    },
    {
      "id": "AU-Tpxb--iU5OvuD2FLz",
      "metric": "tests",
      "op": "LT",
      "error": "10"
    }
  ],
  "isBuiltIn": false,
  "actions": {
    "rename": true,
    "setAsDefault": true,
    "copy": true,
    "associateProjects": true,
    "delete": true,
    "manageConditions": true,
    "delegate": true
  }
}

Hi @pierreguillot,

Thanks for your response.

In this situation, the condition on coverage is not returned because there are no coverage data available. In this case, the Quality Gate criteria on coverage is not taken into consideration to fail the quality gate, and that’s the reason why it’s not returned by the measure API. there is no coverage measure.

That’s exactly the new feature I am requesting: to see all the quality gate conditions, even those which are not computed.

Conditions with uncomputed values are still conditions of the quality gate. They could be returned in the JSON text with their corresponding empty value.

Thanks in advance