MingJun Duan
MingJun Duan

Reputation: 67

How do I know which rule is active or inactive with sonarqube web api?

all. I use sonarqube webapi /api/rules/show?key=squid:S4087&actives=true to get detailed information about a rule. The result is json format data, which field present the rule is active or inactive. Anyone can help? I want to know if the rule is active or inactive, is there any other way to do this?

Sonarqube version is Version 6.7 (build 33306).

Upvotes: 0

Views: 589

Answers (1)

begarco
begarco

Reputation: 776

You can use the following:

api/rules/search?rule_key=squid:S4087&f=actives

Result is:

{
  "total": 1,
  "p": 1,
  "ps": 100,
  "rules": [
    {
      "key": "squid:S4087",
      "type": "CODE_SMELL"
    }
  ],
  "actives": {
    "squid:S4087": [
      {
        "qProfile": "AWWHfPzOrB_d62qUtqCX",
        "inherit": "NONE",
        "severity": "MINOR",
        "params": [],
        "createdAt": "2018-08-29T23:00:39+0200"
      }
    ]
  },
  "qProfiles": {
    "AWWHfPzOrB_d62qUtqCX": {
      "name": "Sonar way",
      "lang": "java",
      "langName": "Java"
    }
  }
}

Upvotes: 1

Related Questions