List of rules with issues


(Jordi P.) #1

Hello,

I am using SonarQube 6.7 LTS Enterprise Edition and I am trying to get a list of all the rules that have raised issues in a specific project. The project has over 100k issues, so getting it manually is not an option and I haven’t found any way in the web API to obtain it. I tried using the search issues operation, but it is limited to the first 10k results.

Any help or suggestion is appreciated.

Jordi


(G Ann Campbell) #2

Hi Jordi,

You’re not going to be able to do this with a single request. I suggest you get the list of the quality profiles in use by the project. For each profile, iterate the rules and for each rule, query for issues for the project.

If this is a one-off effort, you can just read the project’s homepage to get the QP list. If you’re trying to automate, it will be slightly trickier:

  • iterate profiles checking each one to see
    • is the project assigned manually to the QP
    • is it the language default?

At the end, you have a QP per language and can start on the rules queries. Done this way, you’ll query for languages that are irrelevant for your project, but it’s not terribly easy to get the narrowed list of project-relevant languages.

 
HTH,
Ann


(Jordi P.) #3

Thanks Ann, it really helped!

Jordi