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

Add support for Bitbucket Code Insights #151

Closed
wants to merge 1 commit into from

Conversation

goober
Copy link
Contributor

@goober goober commented Apr 6, 2020

This change will add support for Bitbucket Code Insights in favor of regular comments when available. It will fall back on the comments strategy when the Code Insights is not available (it is supported in version 5.15 and later).

@goober
Copy link
Contributor Author

goober commented Apr 14, 2020

@4n4n4s maybe you have some good input on this one?

Copy link
Contributor

@4n4n4s 4n4n4s left a comment

Choose a reason for hiding this comment

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

Hi @goober
first of all cool that you're integrating the code insights. I didn't know that this exists already for so long.

Maybe the "code insights" implementation should completely replace the comments feature and we already should set it to deprecated as 5.15 of bitbucket server was realeased in 2018.

Similar to all the other files in the project please also add the copyright and other info on top of all your added files.

Added some remarks to files, didn't have the time yet to make a test drive on my local instance. For example would be good to know if #149 is also fixed with the annotations.

"SonarQube",
analysisDetails.getAnalysisDate().toInstant(),
analysisDetails.getDashboardUrl(),
"https://www.sonarqube.org/favicon-152.png",
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion deliver this image also in the static resources so that instances of SQ that might not be able to access the internet still have an icon displayed see /common/bug.svg

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@goober goober force-pushed the feature/use-code-insights branch from a2bf205 to fe62f84 Compare April 20, 2020 14:53
@goober
Copy link
Contributor Author

goober commented Apr 20, 2020

@4n4n4s

Maybe the "code insights" implementation should completely replace the comments feature and we already should set it to deprecated as 5.15 of bitbucket server was realeased in 2018.

I agree with you, should I remove the comments implementation in the same PR or should we do it in a separate one? We have just upgraded to Bitbucket Server 7.1.1 and unfortunately, the comments with included images looks really awful.
image

Similar to all the other files in the project please also add the copyright and other info on top of all your added files.

Done

Added some remarks to files, didn't have the time yet to make a test drive on my local instance. For example would be good to know if #149 is also fixed with the annotations.

I have manually verified that this is not an issue with the Code Insights API

@mc1arke
Copy link
Owner

mc1arke commented Apr 26, 2020

should I remove the comments implementation in the same PR or should we do it in a separate one?

I'd remove it in this PR. The delegate implementations currently implement the Decorator interface but don't really have a need to, so removing the old implementation should allow you to collapse code together and simplify the whole implementation.

@goober goober force-pushed the feature/use-code-insights branch from fe62f84 to 47ed592 Compare April 27, 2020 14:04
@goober
Copy link
Contributor Author

goober commented Apr 27, 2020

@mc1arke Thanks for the feedback. I have updated the pull request and removed the comments implementation all together.

@4n4n4s since you did the initial implementation it would be great if you could take a second look so I have not forgotten to remove something.

Copy link
Owner

@mc1arke mc1arke left a comment

Choose a reason for hiding this comment

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

A few additional points from me. Could you also squash your commits (or confirm you're happy for me to squash on merge)?

@goober goober force-pushed the feature/use-code-insights branch from 47ed592 to 4adf6a5 Compare May 20, 2020 14:33
@goober
Copy link
Contributor Author

goober commented May 20, 2020

@mc1arke I have updated the PR and squashed the commits according to your comments.

This change will add support for Bitbucket Code Insights in favor of regular comments when available. It will fall back on the comments strategy when the Code Insights is not available (it is supported in version 5.15 and later).
@goober goober force-pushed the feature/use-code-insights branch from 4adf6a5 to 1eed63f Compare May 20, 2020 14:45
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 5 Code Smells

47.6% 47.6% Coverage
0.0% 0.0% Duplication

@mc1arke
Copy link
Owner

mc1arke commented May 24, 2020

@goober I've merged this with a couple of small modifications for the issues highlighted by Sonarqube and a few formatting tweaks,

@mc1arke mc1arke closed this May 24, 2020
@marvin-w
Copy link
Contributor

marvin-w commented Jun 7, 2020

@goober @mc1arke While trying to get this to work for the cloud version I encountered a really strange behavior.

Is there a chance that this PR broke the overrides for project specific parameters for bitbucket? Only Project and Repository can be overrriden anymore since those come from the UnifiyConfiguration object. All other properties (like URL and token) can now only be defined globally. Individual project settings (through GUI - not CLI) are no longer taken into account. Did someone test this?

**UnifyConfiguration**: sonarqube | 2020.06.07 14:19:48 WARN ce[AXKPJtSCVZIssteDY_fQ][c.g.m.s.p.c.p.b.BitbucketServerPullRequestDecorator] https://api.bitbucket.org **Configuration**: sonarqube | java.lang.IllegalArgumentException: Missing required property com.github.mc1arke.sonarqube.plugin.branch.pullrequest.bitbucket.url

I try to fix it but the code probably doesn't look that nice anymore after doing that since UnifyConfiguration is not on DI.

@mc1arke
Copy link
Owner

mc1arke commented Jun 7, 2020

@marvin-w I've not specifically tested this so can't comment. Since I've just merged the Sonarqube 8.1 changes into master, UnifyConfigration wont exist any more. I'll therefore created a release/1_3 branch if you want to fix any issues, or add features to the plugin supporting the current LTS version of Sonarqube.

The latest plugin releases will currently only support over-riding configuration in the Gitlab decorator since most configuration is now driven through Sonarqube APIs

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.

4 participants