reviewpad icon indicating copy to clipboard operation
reviewpad copied to clipboard

Make `GetLabels()` common to both entity types (pull request and issue)

Open shay2025 opened this issue 2 years ago â€Ē 3 comments

Is your feature request related to a problem? Please describe. We have three files:

  1. https://github.com/reviewpad/reviewpad/blob/main/codehost/github/target/common_target.go
  2. https://github.com/reviewpad/reviewpad/blob/main/codehost/github/target/issue_target.go
  3. https://github.com/reviewpad/reviewpad/blob/main/codehost/github/target/pull_request_target.go

The files 2 and 3 deal in different ways towards the same entity parameters according to the entity being deal with.

The file 1 deals in the same way towards the same entity parameters for both the entity types.

Currently, we have the method GetLabels() being implemented in both file 2 and 3.

However, the implementation is exactly the same for both.

Describe the solution you'd like Move the implementation to https://github.com/reviewpad/reviewpad/blob/main/codehost/github/target/common_target.go where it resides the common methods implementation for both entities.

Describe alternatives you've considered None

Additional context None

shay2025 avatar Sep 01 '22 15:09 shay2025

I can take this one, any additional context or similar pattern to follow? ðŸ‘ðŸ―

michaelc0n avatar Oct 15 '22 21:10 michaelc0n

Hi @michaelc0n Thanks for your help 🙏🏞I believe there is no more context needed. It is only needed to move the current implementation of GetLabels() that resides in codehost/github/target/issue_target.go and codehost/github/target/pull_request_target.go to codehost/github/target/common_target.go 🙂 Any doubts feel free to ask them!

shay2025 avatar Oct 16 '22 17:10 shay2025

👋 @shay2025 @marcelosousa ,

added some code here: https://github.com/michaelc0n/reviewpad/compare/main...michaelc0n:reviewpad:Issue339_Make_GetLabels_common_to_both_entity_types?expand=1

Would you please review and let me know your thoughts (whether this is right approach or if you can recommend another? 😄 ), I was able to move things to common however running into 276 failures when running task test

  • issue primarily appears to be with tests/mocks, *_target.go code loads without error. any help will be appreciated ðŸ‘ðŸ― , thank you!

michaelc0n avatar Oct 21 '22 21:10 michaelc0n

Hi @michaelc0n! We are sorry for the very delayed answer. When running the task test command you should now get no failures if everything is alright, please try again. Also, please open a pull request with your propositions and we will gladly review them 😄

shay2025 avatar Dec 16 '22 13:12 shay2025

Hi @michaelc0n :) Can you please give some feedback on this issue? 🙏

ferreiratiago avatar Jan 02 '23 15:01 ferreiratiago

@ferreiratiago I believe this issue can be closed because after some investigation I saw that the method GetLabels is separated for issues and pull request targets because we are getting the labels from the GitHub issues and pull request objects which depend on the target being handled whereas that type of specification does not occur on the methods in the common target interface.

shay2025 avatar Jan 25 '23 17:01 shay2025