uses: add --formula and --casks flags#9437
uses: add --formula and --casks flags#9437Rylan12 merged 3 commits intoHomebrew:masterfrom Rylan12:uses-flags
Conversation
|
Thanks @Rylan12, can you explain how that fixes the CI workflow? (and why it was broken) I'm not very familiar with this codebase |
|
I'm thinking: maybe the issue is just that the CI nodes are not supposed to have casks tapped. I'm gonna try to untap it, see if it helps. |
|
@fxcoudert see Homebrew/homebrew-core#66268 (comment) The CI error was that test-bot couldn't find a formula called aptible. (Which there isn't; it's a cask.) |
|
It sounds like the CI workflow issue was that This PR adds |
|
I will say though that I like this PR anyway even if it didn't fix any CI errors. |
|
Yes I understand, and I think it makes sense anyway. But I'm hoping that my other fix (to the CI nodes) works, so we can take time to properly review this PR (by someone more capable than myself!). We now have 4 Catalina and 4 Mojave nodes back up, and hopefully the Catalina ones behave better. Let me know if that's not the case. |
Thanks, @fxcoudert! I agree, it seems that homebrew/cask doesn't need to be tapped based on this section of the setup-homebrew action which automatically taps homebrew/cask only if the repo being tested is homebrew/cask. If the other runners don't have homebrew/cask tapped, then it makes sense not to tap it on 10.15 either. I'll go rerun the two affected PRs. If the problems go away, I'll remove the critical label here. I'll probably keep the test-bot PR open for some more reviews as it's a good way to ensure that this won't happen in the future, but it won't be critical anymore. |
|
Okay, this is no longer breaking CI so I'm going to remove the |
|
Review period will end on 2020-12-08 at 00:00:00 UTC. |
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Makes sense to me but some suggested cleanup.
| only = if args.formula? | ||
| :formula |
There was a problem hiding this comment.
I actually think this might be more readable just using args.formula? etc. everywhere.
There was a problem hiding this comment.
I don't think it's more readable when every other command uses only already for this.
There was a problem hiding this comment.
Hate to be picky about this but there are several commands that don't use only (deps, list, outdated, create).
The main difference that I can see is that these commands don't call external methods that take an only parameter. I agree, if we're going to be passing the value of only with e.g. args.named.to_formulae_and_casks(only: only) it makes sense to be only.
However, the distinction (especially with uses) is that --formula and --cask mean that we are expecting to output only formulae or casks rather than input formulae or casks. All of the logic is handled within uses.rb, so I see no reason why we should hold ourselves to a convention being used in some commands with a totally different use case.
To me, reading if show_formulae_and_casks || args.formula? is much easier to understand than if only != :cask. There are too many negatives in the second one. It's like saying "are we not excluding" instead of "are we including"
"if we are not restricting ourselves to casks" versus "if we are including formulae"
There was a problem hiding this comment.
Hate to be picky about this but there are several commands that don't use
only(deps,list,outdated,create).The main difference that I can see is that these commands don't call external methods that take an
onlyparameter. I agree, if we're going to be passing the value ofonlywith e.g.args.named.to_formulae_and_casks(only: only)it makes sense to beonly.
I feel like there's definitely a shared abstraction that all these commands could use to reduce the boilerplate.
There was a problem hiding this comment.
Sorry, are you talking about the commands that do use only or the commands that don't. If the former, I think that already exists for the most part. We could add an option to args that figures out the value of only. It would probably save two lines of code in each file but would reduce duplication. If the latter, I think the reason that they don't use only is that their functions are different enough that it doesn't apply (so there likely isn't much logic to be pulled out)
There was a problem hiding this comment.
Sorry, are you talking about the commands that do use
onlyor the commands that don't. If the former, I think that already exists for the most part.
Either! 😁
We could add an option to
argsthat figures out the value ofonly. It would probably save two lines of code in each file but would reduce duplication.
This sounds good 👍🏻
There was a problem hiding this comment.
Okay, I'll look into it. I'm going to merge this, though, because those changes are not likely to affect the uses command.
(Of course, if they do, this can be modified then)
There was a problem hiding this comment.
@Rylan12 Agreed, this was definitely non-blocking feedback 👍🏻
|
Thanks! I cleaned up the logic a little bit. It's definitely cleaner now. |
|
Review period ended. |
Warning message was: ``` Warning: Calling brew cask install is deprecated! Use brew install [--cask] instead. ``` Refs. - https://github.com/Homebrew/brew/releases/tag/2.6.1 - Homebrew/brew#9437 - Homebrew/brew@e3427fa - https://github.com/Homebrew/brew/releases/tag/2.6.0 - Homebrew/brew#9247 - Homebrew/brew@3c2ec1c
Warning message was: ``` Warning: Calling brew cask install is deprecated! Use brew install [--cask] instead. ``` Refs. - https://github.com/Homebrew/brew/releases/tag/2.6.1 - Homebrew/brew#9437 - Homebrew/brew@e3427fa - https://github.com/Homebrew/brew/releases/tag/2.6.0 - Homebrew/brew#9247 - Homebrew/brew@3c2ec1c
brew stylewith your changes locally?brew testswith your changes locally?brew manlocally and committed any changes?This PR adds
--formulaand--caskflags tobrew usesto filter results by only formulae or casks.I'm marking this as
criticalbecause it is causing issues with our CI in homebrew/core for a few formulae (see Homebrew/homebrew-core#66268)CC: @fxcoudert