Scanner command used : gradle sonar --no-scan --no-rebuild -x test
Languages of the repository: kotlin
I first scanned the repo without exclusions, which resulted in several hundred issues. I then excluded a folder, and the number of issues on the summary → overall code page was reduced, but on the “issues” page they are still listed. SonarQube recognizes them as “removed or never existed”, but lists them anyway. Why is that, and how can I solve it?
Some more details: these issues were fist created via automatic analysis in Sonar Cloud. Then I excluded a folder using .sonar-cloud.properties, which set all those issues to FIXED. Then I switched to CI-based analysis, but forgot to exclude that folder, so the issues were reopened. CI-based analysis with exclusions then made the issues disappear from “summary” but persist in “issues”.
This is working exactly as designed. When an issue is fixed in code or removed via configuration changes such as this, we don’t delete it immediately. We move it to a Closed status, which is reflected in your screenshot.
Imagine that you had spent considerable time triaging these issues: commenting on them and adjusting their statuses. Further imagine that, having done this work, you accidentally excluded them and we deleted them immediately. When you corrected your exclusions, all that work would be gone, and you would be… unhappy.
There are other uses cases around this, but the retention here is quite deliberate, and why Issues are filtered on Open by default.
If these issues remain Closed, they’ll be deleted from the DB in 30 days.
This behavior is expected in SonarQube Cloud. When you exclude files that were previously scanned, the issues are marked as “Closed (Removed)” rather than being deleted to maintain history.
How to solve it:
Filter your View: On the “Issues” page, check the sidebar filters. Select only “Open” or “Unresolved” statuses.
Verify Status: If the issues show a status of “Removed,” your exclusion is working correctly. They will no longer affect your Quality Gate.
Fresh Start: If you want them gone forever, delete the project in SonarQube Cloud and run your GitHub Action again.
I faced a similar cleanup issue while managing my project at this site, and adjusting the filters was the quickest fix.