mc1arke / sonarqube-community-branch-plugin

A plugin that allows branch analysis and pull request decoration in the Community version of Sonarqube
GNU Lesser General Public License v3.0
2.26k stars 526 forks source link

Fix detection of previous PR annotation comments #898

Closed GreyTeardrop closed 3 months ago

GreyTeardrop commented 7 months ago

Description

It seems like the https://github.com/mc1arke/sonarqube-community-branch-plugin/pull/884 change has affected minimization of comments for SonarQube instances that run on Linux or macOS.

The root cause is that MarkdownFormatterFactory uses System.lineSeparator() as the end-of-line character for annotation comments. GraphqlGithubClient.postSummaryComment(), however, uses hardcoded \r\n as end-of-line character, so it isn't able to match legitimate comments if SonarQube is not running on Windows.

This change updates GraphqlGithubClient to also use system end-of-line char.

(It also moves String.format call out of the comment iteration logic to avoid making multiple identical calls).

nklarman commented 6 months ago

Thank you @GreyTeardrop , @mc1arke is it possible to merge this one soon please? it's very annoying to have spam of comments on PRs.

mc1arke commented 3 months ago

Merged, thanks for the contribution