-
-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
various: use numeric Match addressing in strategy
blocks
#196546
base: master
Are you sure you want to change the base?
Conversation
Do we have a style check for this? Because |
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.
Don't really agree with this, sorry. But open to thoughts from @Homebrew/maintainers.
page.scan(regex).map { |match| match.first.tr("_", ".") } | ||
page.scan(regex).map { |match| match[0].tr("_", ".") } |
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.
Strongly prefer match.first
instead of match[0]
TBH, and my impression is that we prefer the former more generally throughout the Homebrew codebase (barring Cask livecheck blocks)
Same, which is probably why we should stick to |
I agree that The reason why numeric addressing is common in match = page.match(regex)
next if match.blank?
"#{match[1]},#{match[2]}" Using numeric addressing when using However, we do have to remember that I did some experimenting and came up with a slight tweak to the aforementioned All that said, if we prefer the |
I'm fine with either approach, but we need to have a style check if we want to force consistency. |
If I use |
I agree. There's no point in doing a mass cleanup like this without any sort of audit or style check to stop it backsliding. That should be done before this PR is merged, not after. |
I'm currently reworking the The recent RuboCop PR got me thinking about this particular inconsistency, so I figured I would improve the status quo while it's top of mind. My thinking behind cleaning up the style in the interim time is that maintainers/contributors often copy from existing I agree that we can't expect to maintain consistency if it isn't enforced with a style check but I also don't think that perfect needs to be the enemy of good in this case. However, if there isn't any wiggle room, then I can leave this as a draft or close it and open a new PR after creating a brew PR for new RuboCops. |
Draft seems good for now, thanks 👍🏻 |
HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>
, where<formula>
is the name of the formula you're submitting?brew test <formula>
, where<formula>
is the name of the formula you're submitting?brew audit --strict <formula>
(after doingHOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>
)? If this is a new formula, does it passbrew audit --new <formula>
?This updates
strategy
blocks inlivecheck
blocks to use numericMatch
addressing (e.g.,match[0]
instead ofmatch.first
), as it's the prevailing standard and is less verbose. I've already done the same thing in homebrew/cask, so this brings homebrew/core in line.In the process, this reworks the
http_load
strategy
block to use a similar pattern to other formulae. The first capture group in the regex isn't optional, so it's guaranteed to exist in this context when the regex matches.The only other related formula is
portaudio
but that will be handled in #196534