Hello everyone, I am making a script that gets infos through the SonarQube web api, and makes a report.
The problem
In the sonar-project.properties files I have excluded some files and directories, but the api request “doesn’t care”, and gives me back all the issues.
The request
How can I exclude these directories and files from the api response?
There’s a few concepts that I think you might be mixing together.
The sonar-project.properties is only relevant when you’re executing analysis. It’s at that point that files are excluded before they make their way to the SonarQube server (at which point, the Web API can’t return those issues, because they aren’t making their way to the server.
An exception: if you weren’t excluding those files at first, after their exclusion the issues will move into a “Closed” state. You can filter on statuses or resolutions using the Web API to remove those issues from the response.
So first, I would suggest checking your analysis logs to make sure the exclusions are being taken into account. And then, see if you need to filter out some issues using the mention query parameters (documented in the Web API documentation).