How to get the exact Operator from SonarCloud for the Conditions in QualityGate?

22 Views Asked by At

I have different quality gates in my Sonarcloud account. In SonarCloud it shows like this

Metric Operator Value
Coverage is less than 40.0%
Duplicated Lines (%) is greater than 1.0%
Maintainability Rating is worse than D
Reliability Rating is worse than D
Security Hotspots Reviewed is less than 50.0%
Security Rating is worse than D

when I call the API for the Quality gate list (api/qualitygatelist) it gives me the metric, operator, and value of all the quality gates present in my sonar cloud account

This has the metric, operator, and value of one of the gates

"conditions": [
            {
                "id": 380056,
                "metric": "new_security_rating",
                "op": "GT",
                "error": "4"
            },
            {
                "id": 380057,
                "metric": "new_reliability_rating",
                "op": "GT",
                "error": "4"
            },
            {
                "id": 380058,
                "metric": "new_maintainability_rating",
                "op": "GT",
                "error": "4"
            },
            {
                "id": 380059,
                "metric": "new_coverage",
                "op": "LT",
                "error": "40"
            },
            {
                "id": 380060,
                "metric": "new_duplicated_lines_density",
                "op": "GT",
                "error": "1"
            },
            {
                "id": 380061,
                "metric": "new_security_hotspots_reviewed",
                "op": "LT",
                "error": "50"
            }
        ] 

Here in Opertor, it shows GT and LT, but in Sonarcloud Operator column it shows "is less than", "is greater than", or "is worse than". Is there any way to get the same operators' names as it shows in Sonarcloud, Or is there any other API to map where it shows GT is Greater than and LT is Less than or worse than?

IF there is anything like that please let me know. Thank you!!!

0

There are 0 best solutions below