utils/github: split GitHub module#10626
utils/github: split GitHub module#10626nandahkrishna merged 4 commits intoHomebrew:masterfrom nandahkrishna:refactor-github-api
Conversation
|
Review period will end on 2021-02-16 at 17:15:01 UTC. |
MikeMcQuaid
left a comment
There was a problem hiding this comment.
This feels like a good split, nice work!
Is it worth adding wrapper functions for now which are |
That sounds good, yes. Will keep things working while I open PRs to update usage in the other repositories. |
|
I've added wrappers for the methods used in other files/repositories (methods in If the way I've handled this is incorrect, please let me know. |
Library/Homebrew/utils/github.rb
Outdated
There was a problem hiding this comment.
May need to deprecate these in the new minor release instead? What does @Homebrew/brew think? Also/instead: I think you can limit these to the only ones you've specifically seen used elsewhere for now?
There was a problem hiding this comment.
Since this whole module is private API, we can forgo the usual deprecation process.
However, since some of these are used in other Homebrew repositories, we should consider whether these should actually be public API instead. My view is private API usage in other repositories should be kept to a minimum.
There was a problem hiding this comment.
I guess usage isn't widespread (for the methods that have been moved): I found 6 instances of open_api usage so far, outside of Homebrew/brew. These were spread across 3 of our repositories (homebrew-linux-dev, actions and homebrew-cask).
Also/instead: I think you can limit these to the only ones you've specifically seen used elsewhere for now?
Alright, seems like it might only be open_api, but I'll check again to be sure.
There was a problem hiding this comment.
Since this whole module is private API, we can forgo the usual deprecation process.
If it's specified/documented as such: I agree.
However, since some of these are used in other Homebrew repositories, we should consider whether these should actually be public API instead. My view is private API usage in other repositories should be kept to a minimum.
Agreed but this isn't always feasible. Homebrew/homebrew-bundle, for example, makes extensive use of private APIs because it's too slow to do otherwise. We could make these public, of course.
Alright, seems like it might only be
open_api, but I'll check again to be sure.
Cool, in that case then: yeh, just a wrapper for that seems sufficient.
There was a problem hiding this comment.
If it's specified/documented as such: I agree.
@api private is our documentation here. Labels it nicely here: https://rubydoc.brew.sh/GitHub.html
Agreed but this isn't always feasible.
For sure. I don't expect it to be zero.
My general thinking is: what are we doing in these repositories that we think that no one outside the Homebrew org should be replicating? For cases where there isn't a strong reason, it should be public API.
There was a problem hiding this comment.
My general thinking is: what are we doing in these repositories that we think that no one outside the Homebrew org should be replicating? For cases where there isn't a strong reason, it should be public API.
Yup, that's fair. I should go and upgrade the brew bundle ones to be public.
|
Review period ended. |
|
As suggested, I've retained the wrapper method only for I haven't made the |
brew stylewith your changes locally?brew typecheckwith your changes locally?brew testswith your changes locally?brew manlocally and committed any changes?The
GitHubmodule inutils/github.rbwas getting too large - beyond the 600 lines style limit - and in #10518 it was decided to temporarily relax that limit, and work on splitting the module in a follow-up PR.This PR splits the
GitHubmodule in the following manner:utils/github/api- all the "access API" and credentials methods and error classes.utils/github- wrapper functions to access specific API endpoints.As a result of this PR, changes will have to be made in some files in other repositories (including
Homebrew/homebrew-caskandHomebrew/homebrew-linux-dev). I'm collecting a list of changes to make and will update it here.See #10518 (comment).