Autofix rubocop checks.

This commit is contained in:
Mike McQuaid 2020-02-19 11:18:40 +00:00
parent 6ce083d294
commit dfa22680df
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
6 changed files with 8 additions and 8 deletions

View File

@ -168,8 +168,8 @@ module Cask
end
def to_h_hash_gsubs(hash)
hash.to_h.each_with_object({}) do |(key, value), h|
h[key] = to_h_gsubs(value)
hash.to_h.transform_values do |value|
to_h_gsubs(value)
end
rescue TypeError
to_h_array_gsubs(hash)

View File

@ -97,7 +97,7 @@ module Cask
@manpagedir ||= HOMEBREW_PREFIX/"share/man"
end
DEFAULT_DIRS.keys.each do |dir|
DEFAULT_DIRS.each_key do |dir|
define_method(dir) do
explicit.fetch(dir, env.fetch(dir, default.fetch(dir)))
end

View File

@ -18,13 +18,13 @@ module Cask
def initialize(**pairs)
pairs.assert_valid_keys!(*VALID_KEYS)
super(Hash[pairs.map { |k, v| [k, Set.new([*v])] }])
super(pairs.transform_values { |v| Set.new([*v]) })
self.default = Set.new
end
def to_json(generator)
Hash[map { |k, v| [k, v.to_a] }].to_json(generator)
transform_values(&:to_a).to_json(generator)
end
end
end

View File

@ -1669,7 +1669,7 @@ class Formula
"root_url" => bottle_spec.root_url,
}
bottle_info["files"] = {}
bottle_spec.collector.keys.each do |os|
bottle_spec.collector.each_key do |os|
bottle_url = "#{bottle_spec.root_url}/#{Bottle::Filename.create(self, os, bottle_spec.rebuild).bintray}"
checksum = bottle_spec.collector[os]
bottle_info["files"][os] = {

View File

@ -196,7 +196,7 @@ class LinkageChecker
version_hash = {}
version_conflict_deps = Set.new
@brewed_dylibs.keys.each do |l|
@brewed_dylibs.each_key do |l|
name = l.split("/").last
unversioned_name, = name.split("@")
version_hash[unversioned_name] ||= Set.new

View File

@ -5,7 +5,7 @@ require "open3"
describe "RuboCop" do
context "when calling `rubocop` outside of the Homebrew environment" do
before do
ENV.keys.each do |key|
ENV.each_key do |key|
ENV.delete(key) if key.start_with?("HOMEBREW_")
end