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
Fix style violations under newer RuboCop #16336
Conversation
def depends_on(one, two) | ||
if one.any_installed_keg | ||
&.runtime_dependencies | ||
&.any? { |dependency| dependency["full_name"] == two.full_name } | ||
&.runtime_dependencies | ||
&.any? { |dependency| dependency["full_name"] == two.full_name } |
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 is nice.
@@ -35,8 +35,7 @@ | |||
end | |||
|
|||
it "does not use older tags when requested not to", :needs_macos do | |||
allow(Homebrew::EnvConfig).to receive(:developer?).and_return(true) | |||
allow(Homebrew::EnvConfig).to receive(:skip_or_later_bottles?).and_return(true) | |||
allow(Homebrew::EnvConfig).to receive_messages(developer?: true, skip_or_later_bottles?: true) |
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 is also quite nice.
843eb8c
to
445e146
Compare
445e146
to
5692c8e
Compare
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 very minor quibble here that can be addressed in another PR. Great job @Bo98!
@@ -25,7 +25,7 @@ def self.paths | |||
# Return all tokens for installed casks. | |||
sig { returns(T::Array[String]) } | |||
def self.tokens | |||
paths.map(&:basename).map(&:to_s) | |||
paths.map { |path| path.basename.to_s } |
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 a bit weird and unlike traditional Ruby patterns. Which cop suggested it?
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.
Performance/MapMethodChain
. Two maps is slower than one.
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.
@Bo98 Yeh, feels like a micro-optimisation to me and not sure I agree with it really but: not enough to object.
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, it might matter over the Formula API hash where we've seen the smallest of things become visible, but probably not for any of these.
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 could also be paths.map { _1.basename.to_s }
, which is the most readable option imo (it avoids the duplication of map
or path
in the other styles).
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.
Personally I hate the _1
variables 😅
Separate PR than the actual version bump to make the diff somewhat digestable.