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

Github comments are minimized even on different project keys #785

Closed
abbudao opened this issue Jul 12, 2023 · 4 comments
Closed

Github comments are minimized even on different project keys #785

abbudao opened this issue Jul 12, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@abbudao
Copy link

abbudao commented Jul 12, 2023

Hey @mc1arke, first of all, thank you for your fantastic work. The plugin works like a charm and has been a very pleasant experience! I'm unsure if my reporting is a bug or should be considered an enhancement.

Describe the bug
Currently, the last comment made by the bot is being minimized regardless of the project key, so only a part of my analysis is visible.

To Reproduce
Steps to reproduce the behavior:
On a mono repo setup, run two Sonarqube analyses with different project keys

Expected behavior

In a mono repo setup, a branch with multiple projects affected should have the latest comment of each project visible.

Screenshots
2023_07_12_0f1_Kleki

Software Versions

  • SonarQube Version: 9.9.1.69595
  • Plugin Version: 1.14

Additional context
I'm available if you need any additional context or help to reproduce. Although I'm not a Java programmer, I can contribute if you support this enhancement but don't have the time to commit to it.

@abbudao abbudao added the bug Something isn't working label Jul 12, 2023
@hballangan-mdsol
Copy link

Noticed this as well for our monorepos.

@OneCyrus
Copy link
Contributor

OneCyrus commented Mar 4, 2024

this drives me crazy as well 🙃

unfortunately it looks like comment's can't store metadata. so the simplest way forward would probably be to check the comment body for the project key.

basically fetch the body through the GraphQL API and filter with a string include of

**Project ID:** MyProject.Key\r\n

currently the comments are filtered here with the bot name. so it should be pretty straight forward to also add a filter with the project key in the body.

getComments(pullRequest, graphqlUrl, headers, pullRequestKey).stream()
.filter(c -> "Bot".equalsIgnoreCase(c.getAuthor().getType()) && login.equalsIgnoreCase(c.getAuthor().getLogin()))
.filter(c -> !c.isMinimized())
.map(Comments.CommentNode::getId)
.forEach(commentId -> this.minimizeComment(graphqlUrl, headers, commentId));

@OneCyrus
Copy link
Contributor

OneCyrus commented Mar 6, 2024

I just implemented some additional logic which should only minimize comments with the same project key. this still needs some testing.

#884

mc1arke pushed a commit that referenced this issue Apr 6, 2024
The Github decorator was not checking the project key listed against a summary
comment so was minimising all summary comments when performing multiple
decorations against a mono-repository. To overcome this, the contents of the
summary comments are being retrieved and only the ones with a project key
matching the current project are being minimised during decoration.
@mc1arke
Copy link
Owner

mc1arke commented Apr 8, 2024

Released as part of 1.19.0 of the plugin (Sonarqube 10.4)

@mc1arke mc1arke closed this as completed Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants