coala / corobo

A bot to help newcomers onboard OS projects! It's awesome!
MIT License
66 stars 103 forks source link

backends.py: Add profile_link function #645

Closed sladyn98 closed 4 years ago

sladyn98 commented 5 years ago

This function is created to map github and gitlab usernames. Ensures correct profile links are mapped for both websites.

Fixes https://github.com/coala/corobo/issues/347

Reviewers Checklist

abhishalya commented 5 years ago

@sladyn98 The changes you made I think are only valid for gitter as backend. You need to find the ways of mapping usernames for other backends too. Also, you need to use this function while creating the issue.

sladyn98 commented 5 years ago

@abhishalya but I think the issue description mentions issues created only via gitter right?In terms of other backends we would by default have to just make a guess for the username because we won't be absolutely sure that they are the original gitlab/github usernames.

sladyn98 commented 5 years ago

If the issue demands In terms of mattermost we could return gitlab. For slack and other backends,I think github would be the best guess. Thoughts?

abhishalya commented 5 years ago

@sladyn98 Well then you should not make changes to the backend.py file. Instead I feel the function should be added to the labhub because that is where the issue is being created.

sladyn98 commented 5 years ago

Yeah @abhishalya I totally agree but that wouldn't change much because we would be doing the same things there as well.

abhishalya commented 5 years ago

I think the functions in the backend.py file are the ones where the output is dependent on the backend used by the corobo. Here since we can only form solution for gitter backend we should not add that function to the backend file. Also, currently the function does nothing, we are not using it. You'll need to form the entire solution and then test it too.

sladyn98 commented 5 years ago

Yeah so for now I think we can add the gitter backend functionality to labhub and test out the functionality,i don't see the point of other backends because we would return only the github profile for that username based on a guess. The other backend we can add is mattermost so I think I'll add a function to labhub and integrate it with create issues and create a PR.

On Thu, Dec 20, 2018, 8:09 PM Abhinav Kaushlya <notifications@github.com wrote:

I think the functions in the backend.py file are the ones where the output is dependent on the backend used by the corobo. Here since we can only form solution for gitter backend we should not add that function to the backend file. Also, currently the function does nothing, we are not using it. You'll need to form the entire solution and then test it too.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/coala/corobo/pull/645#issuecomment-449020164, or mute the thread https://github.com/notifications/unsubscribe-auth/AbgGHv_3vW1TnpRVFQ_klsHhjgm3OtYuks5u66EqgaJpZM4Zb6g- .

sladyn98 commented 5 years ago

We can then test out this functionality,because most of the issues would be created via gitter so this solution should be more than enough

abhishalya commented 5 years ago

@sladyn98 You'll also have to prepare tests for the changes you make. :)

sladyn98 commented 5 years ago

@abhishalya yeah buddy i will write the tests .Is this PR good till now.

sladyn98 commented 5 years ago

@abhishalya I can't seem to find the tests written for backend.py could you help me a bit

abhishalya commented 5 years ago

@sladyn98 Test where you use it :wink:

I mean if you are using the function from the backends.py file in labhub then the test will lie in the labhub test file where the function from the backend file will be automatically tested based on the use in the labhub.

sladyn98 commented 5 years ago

Yeah is there a test for the function message_link which is a part of the backend file,because I thought it would give me a sort of example on how to write a test for it.

abhishalya commented 5 years ago

@sladyn98 git grep message_link

sladyn98 commented 5 years ago

@abhishalya I did a grep search but no such tests popped up.

abhishalya commented 5 years ago

Also please run coala before pushing, so as to avoid bunch of comments from the gitmate-bot.

sladyn98 commented 5 years ago

Also please run coala before pushing, so as to avoid bunch of comments from the gitmate-bot.

Yeah Im sorry I will run that.

sladyn98 commented 5 years ago

@abhishalya now the tests are passing and the coverage has also gone up.

sladyn98 commented 5 years ago

utils/backends.py has still been changed.

Yeah I will change that when I am sure the tests I have written are good to go.

sladyn98 commented 5 years ago

@Makman2 Kindly review this PR.