How to extract or export rules from SonarQube

放肆的年华 提交于 2019-12-01 06:09:28

问题


Appriciate if I can get help for the below scenario. My issues to identify how to extract/export all java rules on SonarQube 4.5.7. I tried the below two API calls but I get a "The page you were looking for doesn't exist".

The sonarqube version I have shows 781 java rules my objective is to extract them to an excel or a csv file

[1]curl -X GET -v -u admin:admin http://localhost:9000/api/rules?language=java

[2]curl -X GET -v -u admin:admin http://localhost:9000/api/rules/search?languages=java >> java.json

The second option seems to generate an output but not all 781 rules are extracted thanks,shavantha


回答1:


URL api/rules/search?languages=java is the correct way to get all Java rules. Response is paginated, so only 10 rules are returned by default :

{ "total": 781, "p": 1, "ps": 10, "rules": [ <here are 10 rules ] }

Use pagination parameter p (page index) for traversing all results. Note that the page size can be changed with parameter ps (defaults 10).




回答2:


http://localhost:9000/api/rules/search?languages=java

the url parameter is languages rather language



来源:https://stackoverflow.com/questions/40885210/how-to-extract-or-export-rules-from-sonarqube

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