sonarqube-community-branch-plugin
sonarqube-community-branch-plugin copied to clipboard
Github comments are minimized even on different project keys
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
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.
Noticed this as well for our monorepos.
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.
https://github.com/mc1arke/sonarqube-community-branch-plugin/blob/895a89d75176c40f95bf5c14fd238d5d3f5761b9/src/main/java/com/github/mc1arke/sonarqube/plugin/almclient/github/v4/GraphqlGithubClient.java#L137-L141
I just implemented some additional logic which should only minimize comments with the same project key. this still needs some testing.
#884
Released as part of 1.19.0 of the plugin (Sonarqube 10.4)