SonarQube is correctly raising issues as comments and highlighting them in our PRs. We are using SonarCloud and we have integrated this into Azure DevOps pipeline.
However, if you resolve a Sonar comment and then push anything to branch, Sonar will run again, and delete the original Sonar comment (leaving our comment reply without the parent comment originally created by Sonar), see here:
Is there any way to prevent SonarQube from deleting the original comment highlighting the issue detected after the issue has been resolved and a commit posted to the branch?
This is by design in SonarQube. According to SonarQube's official docs, if the AzureDevOps instance is configured correctly and you set an issue in SonarQube to resolved, the AzureDevOps Pull Request Comment will automatically be resolved. Likewise, when you fix an issue in the code and run the analysis build another time, the issue will be resolved in Sonar and deleted in AzureDevOps.
SonarQube has made the choice to delete the comments when the issues are solved to be aligned with the current codebase. Otherwise, you would see comments linked to issues that don’t exist in the code anymore. See the ticket in SonarQube community for the detailed info.