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
style: fix on_macos/on_linux resource block checks #10118
Conversation
Review period ended. |
The
|
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.
Changes look good once CI passes on all of homebrew/core
.
Why do resource blocks need a version spec? Isn't it just based on the URL? If it's needed, I think we should allow both: resource "..." do
on_macos do
url "..."
sha256 "..."
end
end and resource "..." do
on_macos do
url "..."
version "..."
sha256 "..."
end
end |
4d1434d
to
27ce575
Compare
Co-Authored-By: Rylan Polster <rslpolster@gmail.com>
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 wrote some of this code so my review might be biased 😝
Well, you can approve my code and I'll approve your code 😉 ✅ I'll let this sit for a tad longer in case some other maintainers have opinions. Since it's blocking a core PR, though, I'll merge it later today. |
end | ||
RUBY | ||
end | ||
|
||
it "the content of the on_linux block is wrong in a resource block" do |
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.
One thing I noticed was that a lot of the tests in the tests/rubocops
directory don't have very good descriptions for it
and context
blocks. (I don't blame you @Rylan12 in this particular PR since the surrounding descriptions here aren't very... good)
For example, if the test surrounding this comment fails, here's what brew tests
spits out:
Failures:
1) RuboCop::Cop::FormulaAudit::ComponentsOrder resource the content of the on_linux block is wrong in a resource block
In contrast, here's what is outputted when this test in test/utils/curl_spec
fails:
Failures:
1) Utils::Curl curl_args returns --disable as the first argument when HOMEBREW_CURLRC is not set
This is an issue that probably should be addressed in one or more future PRs (by willing volunteers, of course)
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.
Yeah, I've certainly noticed this as well. I went ahead and fixed up just this section. Later, I can start going through and fixing up other sections as well.
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?This PR fixes a
brew style
bug for theon_macos
andon_linux
checks with resource blocks.Previously, the following would cause an error that broke
brew style
(this example is from Homebrew/homebrew-core#67535):Now, this will trigger the style issue and give the following message:
Edit: this is now allowed. The check will still verify that only url and sha256 or url, version, and sha256 methods are used in on_macos/on_linux blocks in resource blocks (even if they are nested in if statements)