red_888
(red 888)
August 28, 2020, 3:57pm
1
I was looking in the UI and googling but didnt turn anything up
I have 2 teams in bitbucket and many projects in each
I just want to generate a csv that includes each sonar project name and the current code coverage of that project
How do I do this? Can I export this csv/pdf/whatever report that includes projects in both of my organizations?
red_888
(red 888)
September 9, 2020, 5:26pm
2
Is this impossible or not supported? Any tips?
mickaelcaro
(Mickaël Caro)
September 22, 2020, 6:43am
3
Hi @red_888
This feature is not available on SonarCloud.
If you seek for this kind of feature, SonarQube does propose it (starting a certain edition).
Mickaël
sodul
(Stephane Odul)
September 22, 2020, 7:32am
4
I would look into the rest API to export this. SonarSource has a json based REST API that should be relatively easy to query with Python’s requests library for example.
It is not explicitly documented but you can look at https://sonarcloud.io/web_api
We have not used it yet, but the link used to be present at the bottom of the pages and still works.
curl -u <token>: -i -H "Accept: application/json" https://sonarcloud.io/api/authentication/validate
curl -u <token>: -i -H "Accept: application/json" https://sonarcloud.io/api/user_tokens/search
curl -u <token>: -i -H "Accept: application/json" https://sonarcloud.io/api/projects/search\?organization\=<your_org>
Note that you will have to create a token, and that token replaces your username, and password becomes empty.