Components: GitHub PR decoration
Versions used: Sonarcloud, so no idea. Latest, probably?
When fixing the very last issues in a PR and pushing to that PR, Sonar does not remove the comments about the fixed issues.
This is a bit inconsistent with the behavior when you push to a PR and only fixed some issues, in which case previous comments are removed. Maybe that’s related to the fact Sonar does not add reviews to PR that don’t have any issue (anymore)?
And it’s a bit confusing, too: when you look at the PR, it seems there are still issues, but the Sonar check status is green…
Steps to reproduce
- Open a PR on GitHub with analysis issues.
- Wait for the Sonar check: the Sonar check status will be set to “red” and a review will be added with comments on lines with issues.
- Push a new commit to the PR that fixes all the issues.
- Wait for the Sonar check: the Sonar check status will be set to “green”, but the existing review will be unchanged and no new review will be added to explain that the PR is now free of any issue.
In most cases fixing the issues will require changes to the line on which Sonar commented, so GitHub will automatically hide the comments as outdated. Example: https://github.com/yrodiere/hibernate-search/pull/37#pullrequestreview-155383797
However, I can imagine cases where changes are on a different line, which means GitHub will not hide the comments. And it seems at least some people on the Sonar team share my opinion.
If the idea is to keep the issues for “archive” purposes, maybe Sonar could just “Resolve” conversations on out-of-date reviews automatically instead of deleting comments? Then it would not be a problem to also do it when all issues are fixed.