Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix detection of previous PR annotation comments #898

Merged
merged 1 commit into from
Aug 11, 2024

Conversation

GreyTeardrop
Copy link
Contributor

Description

It seems like the #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).

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.
Copy link
Contributor

@OneCyrus OneCyrus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@nklarman
Copy link

nklarman commented May 2, 2024

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

@this-is-tobi this-is-tobi mentioned this pull request Jul 28, 2024
@mc1arke mc1arke merged commit 9ec99e0 into mc1arke:master Aug 11, 2024
7 checks passed
@mc1arke
Copy link
Owner

mc1arke commented Aug 11, 2024

Merged, thanks for the contribution

@GreyTeardrop GreyTeardrop deleted the fix-comment-minimizing branch August 13, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants