Hi everyone,
I’m currently searching for two Java projects to use in my research. Ideally, one project should have a good maintainability rating (A), and the other should have a poor maintainability rating (C or worse).
My questions:
Is there any way to filter projects under the “Explore” tab in SonarCloud by their maintainability rating?
Can I limit the selection to only projects in the M size category (1k-10k lines of code)? Whenever I select this category, the L and XL categories are also automatically included, which isn’t what I want.
I’d appreciate any tips or guidance on how to achieve this. Thanks in advance for your help!
Using my browser’s dev tools, I can see that the explore page uses api/components/search_projects. That API is marked internal, so you don’t want to base a production script on it, but for your 1-off purposes it should work. Take a look at the filter parameter and play around with calling it directly to see if you can find what you need.
Thank you for the quick response—I really appreciate it. I’ve been experimenting with the API and managed to filter the results to get what I need. However, I’ve encountered another problem. It seems that the maximum number of projects I can retrieve using the API is 10,000. Even though there are more than 10,000 projects on the site, the script always seems to analyze the same set of 10,000 projects.
Is this number the hard cap for projects accessible via the API, or is there a workaround to access additional projects?
To be honest, I’m a bit surprised you’re hitting that. I thought that had been removed, but clearly not. So if it’s still there, then yes it’s a hard cap.
That said, surely you can find what you need in the first 10k?