/api/qualitygates/project_status only returning some of the metrics

sonarcloud
web_api
q_gate

(Roy Sela) #1

Hi,

I’m trying to get a specific project’s quality gate status by using the /api/qualitygates/project_status entrypoint, and only getting some of the actual metrics (some failing and some ok but some are just missing from the actual response), am I wrong to expect all the relevant metrics to appear?

I’m using a custom quality gate which defines the below metrics (similar to the Sonar Way, only based on the overall metrics and not the leak period ones):

Running the API returned the below result - note some metrics are fine and some are not, but maintainability is missing entirely from the response:
{

"projectStatus": {

    "status": "ERROR",

    "conditions": [

        {

            "status": "ERROR",

            "metricKey": "branch_coverage",

            "comparator": "LT",

            "errorThreshold": "80",

            "actualValue": "43.3"

        },

        {

            "status": "OK",

            "metricKey": "duplicated_lines_density",

            "comparator": "GT",

            "errorThreshold": "3",

            "actualValue": "1.6"

        },

        {

            "status": "OK",

            "metricKey": "sqale_rating",

            "comparator": "GT",

            "errorThreshold": "1",

            "actualValue": "1"

        },

        {

            "status": "ERROR",

            "metricKey": "reliability_rating",

            "comparator": "GT",

            "errorThreshold": "1",

            "actualValue": "3"

        },

        {

            "status": "ERROR",

            "metricKey": "security_rating",

            "comparator": "GT",

            "errorThreshold": "1",

            "actualValue": "2"

        }

    ],

    "periods": [

        {

            "index": 1,

            "mode": "date",

            "date": "2018-12-01T01:04:39+0100",

            "parameter": "2018-12-01"

        }

    ],

    "ignoredConditions": false

}

}

Needless to say, the actual maintainability score does exist for the project… This time it did not fail the quality gate, but I don’t understand why it doesn’t appear in the API response (and whether it will actually appear in case it does break it), especially as other “good” metrics appear in it.

Thanks,
Roy


(Colin Mueller) #2

Roy,

For a lot of weird historical reasons, maintainability rating = sqale_rating

Colin


(Roy Sela) #3

Ohhh sorry, did not know that and failed to notice that specific entry… thanks!