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

[BitbucketServer] Add inline mode. #549

Closed
sunshinejr opened this issue Mar 31, 2018 · 3 comments
Closed

[BitbucketServer] Add inline mode. #549

sunshinejr opened this issue Mar 31, 2018 · 3 comments
Labels
enhancement help wanted You Can Do This This idea is well spec'd and ready for a PR

Comments

@sunshinejr
Copy link
Member

sunshinejr commented Mar 31, 2018

So the inline mode was finished (#529), but unfortunately only for GitHub. I would do it as well, butI don't really have an access to BitbucketServer to test it. BUT, I can provide guidelines on how to implement this. And I'm gonna try to give as much details as possible, so this task might be a good started for someone that wants to get involved in Danger JS or in Typescript in general.

If you want to figure it all by yourself, just don't read the rest of this issue 😅

API

First of all, there is the API. Docs for Bitbucket Server are here I believe. So, in BitBucketServerAPI you would need to add few functions that handle:

Platform

All of the above will be used in BitBucket platform. The most important function in BitBucket platform is supportsInlineComments function, here. Basically Executor, the guy that does all the logic for commenting based on platform info, checks if the platform supports inline comments and if not, it will just post all inline comments in the main comment. Right now this function returns false in BitbucketServer, but after switching it to true you also need to make sure that all of the following are implemented:

As you can see, apart from createInlineComment, it's just calling the API and returning the Promise to the Executor. This function is kinda complicated, at least in GitHub, because based on a line you need to find a "position" in the diff. But, from the API docs, it seems like it's easier on BitBucket as you pass the line to the API, instead of calculating the position.

Templates

In #529 I've already added templates for BitBucket as well, even with tests, so you would just need to test if the template for inline comments is all right. The source file for templates is here.

Tests

I already mentioned tests above, so yeah, you would need to test it as well. But, it's a good thing. By using tests you almost don't need to wait on CI to tell you that everything is cool. So, what do we test?

Testing environment

You would also need a testing PR that would verify if your setup works after all. You can see the CI setup on Harvey, for Travis, here.

Development

Make sure to use yarn build and yarn test after your changes (or just use Orta's plugin for vscode-jest). yarn declarations after the PR as well.

I think this is all the info I needed beforehand, if you spot something there @orta, don't hesitate to edit this post 😅

@sunshinejr sunshinejr added enhancement help wanted You Can Do This This idea is well spec'd and ready for a PR labels Mar 31, 2018
@orta
Copy link
Member

orta commented Mar 31, 2018

Or try the trial of https://wallabyjs.com 🍡

@codestergit
Copy link
Contributor

codestergit commented Apr 4, 2018

@orta @sunshinejr I am taking this. I have completed basic RnD.

Bitbucket server rest api provides file inline comments. I will implement it in next couple of days.

I will let you know if I needed some help.

Thanks @sunshinejr for detailed writeup It is super helpful.

@sunshinejr
Copy link
Member Author

I believe that this was implemented in #560, so I'm closing this one 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted You Can Do This This idea is well spec'd and ready for a PR
Projects
None yet
Development

No branches or pull requests

3 participants