How to export Quality Profile rules into Excel

2019-08-31 03:26发布

We are using SonarQube 4.5.1 for our projects and are planning to provide list of rules activation/deactivation to end users.

What is best way to export/import within SonarQube in Excel?

There is option of backup in Quality Profile but it did not export description. I looked directly in the database with rules table, but due to some HTML tag this is not working for delimited with semicolon.

I would also like to know how we can add customized rules to existing set of rules. What is the procedure?

3条回答
做个烂人
2楼-- · 2019-08-31 03:51

To export the Rules on JSON format:

For C++ rules you can use the URL:

http://<localhost:<port/>>api/rules/search?languages=c%2B%2B

For C rules you can use the URL:

http://<localhost:<port/>>api/rules/search?languages=cs
查看更多
劳资没心,怎么记你
3楼-- · 2019-08-31 03:56

The SonarQube interface is really going to be the best referential for your users. Based on the info in your comment, I'd suggest a simple web form rather than trying to construct a spreadsheet.

It may help to know that you can construct the URL to any rule using the repositoryKey and key returned in the XML profile backup:

http://[server]/coding_rules#rule_key=[repositoryKey]:[key]

E.G. https://sonarcloud.io/api/rules/search?rule_key=csharpsquid%3AS907

The API supports many parameters that are documented here: https://sonarcloud.io/web_api/api/rules/search (click the Parameters header above the horizontal line to open the descriptions).

For example, the languages parameter makes it possible to search for rules that apply to one or more languages (a comma-separated list). To get the list of all C# rules, you can use https://sonarcloud.io/api/rules/search?languages=cs

查看更多
甜甜的少女心
4楼-- · 2019-08-31 04:04

After saving result of search API in json file, to cover entirely the question, import of json result in excel can be done with https://github.com/VBA-tools/VBA-JSON

查看更多
登录 后发表回答