-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
utils/github: split GitHub module #10626
utils/github: split GitHub module #10626
Conversation
Review period will end on 2021-02-16 at 17:15:01 UTC. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@api_credentials ||= begin | ||
Homebrew::EnvConfig.github_api_token || keychain_username_password | ||
end | ||
odeprecated "GitHub.api_credentials", "GitHub::API.api_credentials" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?brew man
locally and committed any changes?The
GitHub
module inutils/github.rb
was 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
GitHub
module 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-cask
andHomebrew/homebrew-linux-dev
). I'm collecting a list of changes to make and will update it here.See #10518 (comment).