Fix style
This commit is contained in:
parent
c0b745e46b
commit
2e6b6ab3a2
@ -99,10 +99,10 @@ module Cask
|
||||
|
||||
require "cask/auditor"
|
||||
|
||||
casks.map do |cask|
|
||||
casks.to_h do |cask|
|
||||
odebug "Auditing Cask #{cask}"
|
||||
[cask.sourcefile_path, Auditor.audit(cask, **options)]
|
||||
end.to_h
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -77,7 +77,7 @@ module Cask
|
||||
.returns(T::Hash[Symbol, T.any(String, Pathname, T::Array[String])])
|
||||
}
|
||||
def self.canonicalize(config)
|
||||
config.map do |k, v|
|
||||
config.to_h do |k, v|
|
||||
key = k.to_sym
|
||||
|
||||
if DEFAULT_DIRS.key?(key)
|
||||
@ -85,7 +85,7 @@ module Cask
|
||||
else
|
||||
[key, v]
|
||||
end
|
||||
end.to_h
|
||||
end
|
||||
end
|
||||
|
||||
sig { returns(T::Hash[Symbol, T.any(String, Pathname, T::Array[String])]) }
|
||||
|
||||
@ -52,7 +52,7 @@ class Descriptions
|
||||
private
|
||||
|
||||
def short_names
|
||||
@short_names ||= @descriptions.keys.map { |k| [k, k.split("/").last] }.to_h
|
||||
@short_names ||= @descriptions.keys.to_h { |k| [k, k.split("/").last] }
|
||||
end
|
||||
|
||||
def short_name_counts
|
||||
|
||||
@ -166,7 +166,7 @@ module Homebrew
|
||||
spdx_license_data = SPDX.license_data
|
||||
spdx_exception_data = SPDX.exception_data
|
||||
new_formula_problem_lines = []
|
||||
formula_results = audit_formulae.sort.map do |f|
|
||||
formula_results = audit_formulae.sort.to_h do |f|
|
||||
only = only_cops ? ["style"] : args.only
|
||||
options = {
|
||||
new_formula: new_formula,
|
||||
@ -198,7 +198,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
[f.path, { errors: fa.problems + fa.new_formula_problems, warnings: [] }]
|
||||
end.to_h
|
||||
end
|
||||
|
||||
cask_results = if audit_casks.empty?
|
||||
{}
|
||||
|
||||
@ -39,7 +39,7 @@ module Homebrew
|
||||
|
||||
CacheStoreDatabase.use(:linkage) do |db|
|
||||
kegs = if args.named.to_default_kegs.empty?
|
||||
Formula.installed.map(&:any_installed_keg).reject(&:nil?)
|
||||
Formula.installed.map(&:any_installed_keg).compact
|
||||
else
|
||||
args.named.to_default_kegs
|
||||
end
|
||||
|
||||
@ -218,7 +218,7 @@ module Homebrew
|
||||
|
||||
# Generate a bidirectional mapping of commits <=> formula files.
|
||||
files_to_commits = {}
|
||||
commits_to_files = commits.map do |commit|
|
||||
commits_to_files = commits.to_h do |commit|
|
||||
files = Utils.safe_popen_read("git", "-C", path, "diff-tree", "--diff-filter=AMD",
|
||||
"-r", "--name-only", "#{commit}^", commit).lines.map(&:strip)
|
||||
files.each do |file|
|
||||
@ -233,7 +233,7 @@ module Homebrew
|
||||
EOS
|
||||
end
|
||||
[commit, files]
|
||||
end.to_h
|
||||
end
|
||||
|
||||
# Reset to state before cherry-picking.
|
||||
safe_system "git", "-C", path, "reset", "--hard", original_commit
|
||||
|
||||
@ -62,7 +62,7 @@ module Homebrew
|
||||
content.gsub!(/(Homebrew is generously supported by) .*\Z/m, "\\1 #{named_sponsors.to_sentence}.\n")
|
||||
content << "\n#{logo_sponsors.join}\n" if logo_sponsors.presence
|
||||
|
||||
File.open(readme, "w+") { |f| f.write(content) }
|
||||
File.write(readme, content)
|
||||
|
||||
diff = system_command "git", args: [
|
||||
"-C", HOMEBREW_REPOSITORY, "diff", "--exit-code", "README.md"
|
||||
|
||||
@ -54,7 +54,7 @@ module Homebrew
|
||||
content.gsub!(/(Homebrew's other current maintainers are).*\./,
|
||||
"\\1 #{sentences[:other]}.")
|
||||
|
||||
File.open(readme, "w+") { |f| f.write(content) }
|
||||
File.write(readme, content)
|
||||
|
||||
diff = system_command "git", args: [
|
||||
"-C", HOMEBREW_REPOSITORY, "diff", "--exit-code", "README.md"
|
||||
|
||||
@ -61,7 +61,7 @@ module SharedEnvExtension
|
||||
sig { returns(T::Hash[String, String]) }
|
||||
def remove_cc_etc
|
||||
keys = %w[CC CXX OBJC OBJCXX LD CPP CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS LDFLAGS CPPFLAGS]
|
||||
keys.map { |key| [key, delete(key)] }.to_h
|
||||
keys.to_h { |key| [key, delete(key)] }
|
||||
end
|
||||
|
||||
sig { params(newflags: String).void }
|
||||
|
||||
@ -2021,11 +2021,11 @@ class Formula
|
||||
def to_recursive_bottle_hash(top_level: true)
|
||||
bottle = bottle_hash
|
||||
|
||||
bottles = bottle["files"].map do |tag, file|
|
||||
bottles = bottle["files"].to_h do |tag, file|
|
||||
info = { "url" => file["url"] }
|
||||
info["sha256"] = file["sha256"] if tap.name != "homebrew/core"
|
||||
[tag.to_s, info]
|
||||
end.to_h
|
||||
end
|
||||
|
||||
hash = {
|
||||
"name" => name,
|
||||
|
||||
@ -189,8 +189,8 @@ module Homebrew
|
||||
h, stdout = stdout.split("\r\n\r\n", 2)
|
||||
|
||||
headers << h.split("\r\n").drop(1)
|
||||
.map { |header| header.split(/:\s*/, 2) }
|
||||
.to_h.transform_keys(&:downcase)
|
||||
.to_h { |header| header.split(/:\s*/, 2) }
|
||||
.transform_keys(&:downcase)
|
||||
end
|
||||
|
||||
return headers if status.success?
|
||||
|
||||
@ -53,9 +53,9 @@ describe "brew pr-pull" do
|
||||
safe_system Utils::Git.git, "add", formula_file
|
||||
safe_system Utils::Git.git, "commit", "-m", "foo 1.0 (new formula)"
|
||||
original_hash = `git rev-parse HEAD`.chomp
|
||||
File.open(formula_file, "w") { |f| f.write(formula_revision) }
|
||||
File.write(formula_file, formula_revision)
|
||||
safe_system Utils::Git.git, "commit", formula_file, "-m", "revision"
|
||||
File.open(formula_file, "w") { |f| f.write(formula_version) }
|
||||
File.write(formula_file, formula_version)
|
||||
safe_system Utils::Git.git, "commit", formula_file, "-m", "version", "--author=#{secondary_author}"
|
||||
described_class.autosquash!(original_hash, path: path)
|
||||
expect(path.git_commit_message).to include("foo 2.0")
|
||||
|
||||
@ -16,9 +16,7 @@ describe Homebrew::Diagnostic::Checks do
|
||||
anaconda = "#{path}/anaconda"
|
||||
python = "#{path}/python"
|
||||
FileUtils.touch anaconda
|
||||
File.open(python, "w") do |file|
|
||||
file.write("#! #{`which bash`}\necho -n '#{python}'\n")
|
||||
end
|
||||
File.write(python, "#! #{`which bash`}\necho -n '#{python}'\n")
|
||||
FileUtils.chmod 0755, anaconda
|
||||
FileUtils.chmod 0755, python
|
||||
|
||||
|
||||
@ -17,26 +17,26 @@ describe Utils::Git do
|
||||
HOMEBREW_CACHE.cd do
|
||||
system git, "init"
|
||||
|
||||
File.open("README.md", "w") { |f| f.write("README") }
|
||||
File.write("README.md", "README")
|
||||
system git, "add", HOMEBREW_CACHE/"README.md"
|
||||
system git, "commit", "-m", "File added"
|
||||
@h1 = `git rev-parse HEAD`
|
||||
|
||||
File.open("README.md", "w") { |f| f.write("# README") }
|
||||
File.write("README.md", "# README")
|
||||
system git, "add", HOMEBREW_CACHE/"README.md"
|
||||
system git, "commit", "-m", "written to File"
|
||||
@h2 = `git rev-parse HEAD`
|
||||
|
||||
File.open("LICENSE.txt", "w") { |f| f.write("LICENCE") }
|
||||
File.write("LICENSE.txt", "LICENCE")
|
||||
system git, "add", HOMEBREW_CACHE/"LICENSE.txt"
|
||||
system git, "commit", "-m", "File added"
|
||||
@h3 = `git rev-parse HEAD`
|
||||
|
||||
File.open("LICENSE.txt", "w") { |f| f.write("LICENSE") }
|
||||
File.write("LICENSE.txt", "LICENSE")
|
||||
system git, "add", HOMEBREW_CACHE/"LICENSE.txt"
|
||||
system git, "commit", "-m", "written to File"
|
||||
|
||||
File.open("LICENSE.txt", "w") { |f| f.write("test") }
|
||||
File.write("LICENSE.txt", "test")
|
||||
system git, "add", HOMEBREW_CACHE/"LICENSE.txt"
|
||||
system git, "commit", "-m", "written to File"
|
||||
@cherry_pick_commit = `git rev-parse HEAD`
|
||||
|
||||
@ -351,7 +351,7 @@ module GitHub
|
||||
end
|
||||
raise API::Error, "The team #{org}/#{team} does not exist" if result["organization"]["team"].blank?
|
||||
|
||||
result["organization"]["team"]["members"]["nodes"].map { |member| [member["login"], member["name"]] }.to_h
|
||||
result["organization"]["team"]["members"]["nodes"].to_h { |member| [member["login"], member["name"]] }
|
||||
end
|
||||
|
||||
def sponsors_by_tier(user)
|
||||
|
||||
@ -56,7 +56,7 @@ module Utils
|
||||
errors["`paths` (first) parameter"] = ["`paths` was empty"] if paths.blank?
|
||||
|
||||
Array(paths).each do |path|
|
||||
str = File.open(path, "rb", &:read) || ""
|
||||
str = File.binread(path) || ""
|
||||
s = StringInreplaceExtension.new(str)
|
||||
|
||||
if before.nil? && after.nil?
|
||||
@ -75,7 +75,7 @@ module Utils
|
||||
|
||||
# @api private
|
||||
def inreplace_pairs(path, replacement_pairs, read_only_run: false, silent: false)
|
||||
str = File.open(path, "rb", &:read) || ""
|
||||
str = File.binread(path) || ""
|
||||
contents = StringInreplaceExtension.new(str)
|
||||
replacement_pairs.each do |old, new|
|
||||
ohai "replace #{old.inspect} with #{new.inspect}" unless silent
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user