You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
positing inline comments to a pull request, GitHub version
update inline comments to a pull request, GitHub version
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?
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 inBitBucket
platform issupportsInlineComments
function, here. BasicallyExecutor
, 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 returnsfalse
inBitbucketServer
, but after switching it totrue
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 theExecutor
. 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 theline
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
andyarn 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 😅
The text was updated successfully, but these errors were encountered: