Hello @thomaswojtowicz,
Welcome to the SonarSource community forum.
I think that you are not looking at the right piece of the API response. I could not double check on SonarQube 8.1 (The LTS (Long Term Support) is 7.9, the latest is 8.4) but I am quite confident that the behaviour is the same. api/qualitygates/projects_status
return 2 pieces of information:
- What is the latest quality gate status of the project
- How the new code period is computed
Something like:
{
"projectStatus": {
"status": "ERROR",
"conditions": [
{
"status": "OK",
"metricKey": "new_reliability_rating",
"comparator": "GT",
"periodIndex": 1,
"errorThreshold": "1",
"actualValue": "1"
},
{
"status": "OK",
"metricKey": "new_security_rating",
"comparator": "GT",
"periodIndex": 1,
"errorThreshold": "1",
"actualValue": "1"
},
{
"status": "ERROR",
"metricKey": "new_maintainability_rating",
"comparator": "GT",
"periodIndex": 1,
"errorThreshold": "1",
"actualValue": "2"
},
{
"status": "ERROR",
"metricKey": "new_coverage",
"comparator": "LT",
"periodIndex": 1,
"errorThreshold": "80",
"actualValue": "0.0"
},
{
"status": "OK",
"metricKey": "new_duplicated_lines_density",
"comparator": "GT",
"periodIndex": 1,
"errorThreshold": "3",
"actualValue": "0.0"
}
],
"periods": [
{
"index": 1,
"mode": "SPECIFIC_ANALYSIS",
"date": "2019-10-07T11:29:08+0200",
"parameter": "AW2ljYhOpSgD31o0eY4H"
}
],
"ignoredConditions": false
}
}
You must be looking at the periods
data (that explains how the new code period is computed, most of the time based on previous version …
whereas you should look at the projectStatus
data that give you the quality gate status and always refer to the last analysis.
Olivier