How to export Quality Profile rules into Excel

孤街醉人 提交于 2019-12-11 23:08:03

问题


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?


回答1:


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




回答2:


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:


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



来源:https://stackoverflow.com/questions/32990535/how-to-export-quality-profile-rules-into-excel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!