简体   繁体   中英

How to use a union operator in SonarQube web services?

I would like to select from all the issues I have all the blocking issues and all the vulnerability issues, which are Blocker, Critical or Major. How can I do that in one request for SonarQube 6.4? If I do

http://localhost:9000/api/issues/search
severities=BLOCKER,CRITICAL,MAJOR&type=vulnerability&additionalFields=comments

I will have the vulnerability issues only.

And if I do two requests, one for blocker issues and one for the vulnerabilities, I will have blocking vulnerabilities which are redundant.

api/issues/search does not allow to combine filters. It will "AND" all conditions together.

I assumed that you are asking about how to query for these issues:

           CODE_SMELL | BUG | VULNERABILITY
BLOCKER  | YES        | YES | YES
CRITICAL | no         | no  | YES
MAJOR    | no         | no  | YES
MINOR    | no         | no  | YES
INFO     | no         | no  | YES

So I suggest:

(for to get all BLOCKER issues of CODE_SMELL and BUG)

           CODE_SMELL | BUG | VULNERABILITY
BLOCKER  | YES        | YES | no
CRITICAL | no         | no  | no 
MAJOR    | no         | no  | no 
MINOR    | no         | no  | no
INFO     | no         | no  | no

(for to get all issues of VULNERABILITY)

           CODE_SMELL | BUG | VULNERABILITY
BLOCKER  | no         | no  | YES
CRITICAL | no         | no  | YES
MAJOR    | no         | no  | YES
MINOR    | no         | no  | YES
INFO     | no         | no  | YES

So you will not have duplicated issues, but have to do two requests.

There are three types of issues

  • BUG
  • CODE_SMELL
  • VULNERABILITY

All of this issues types can have any severity set. So, if you want all issues (of any type) with Blocker, Critical and Major severity there should be this params in your request.

severities=BLOCKER,CRITICAL,MAJOR& types=CODE_SMELL,BUG,VULNERABILITY &additionalFields=comments

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM