Skip to content
Snippets Groups Projects
Unverified Commit ea47dce9 authored by Jonathan Chang's avatar Jonathan Chang Committed by GitHub
Browse files

Merge pull request #7991 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-0.88.0

build(deps): bump rubocop from 0.87.1 to 0.88.0 in /Library/Homebrew
parents 0f6bc627 76709d82
No related branches found
No related tags found
No related merge requests found
Showing
with 36 additions and 29 deletions
......@@ -81,7 +81,7 @@ GEM
rspec-support (3.9.3)
rspec-wait (0.0.9)
rspec (>= 3, < 4)
rubocop (0.87.1)
rubocop (0.88.0)
parallel (~> 1.10)
parser (>= 2.7.1.1)
rainbow (>= 2.2.2, < 4.0)
......
......@@ -208,11 +208,12 @@ rescue Exception => e # rubocop:disable Lint/RescueException
# BuildErrors are specific to build processes and not other
# children, which is why we create the necessary state here
# and not in Utils.safe_fork.
if error_hash["json_class"] == "BuildError"
case error_hash["json_class"]
when "BuildError"
error_hash["cmd"] = e.cmd
error_hash["args"] = e.args
error_hash["env"] = e.env
elsif error_hash["json_class"] == "ErrorDuringExecution"
when "ErrorDuringExecution"
error_hash["cmd"] = e.cmd
error_hash["status"] = e.status.exitstatus
error_hash["output"] = e.output
......
......@@ -77,7 +77,7 @@ module Cask
Manpage,
PostflightBlock,
Zap,
].each_with_index.flat_map { |classes, i| [*classes].map { |c| [c, i] } }.to_h
].each_with_index.flat_map { |classes, i| Array(classes).map { |c| [c, i] } }.to_h
(@@sort_order[self.class] <=> @@sort_order[other.class]).to_i
end
......
......@@ -34,7 +34,7 @@ module Cask
directives.assert_valid_keys!(*ORDERED_DIRECTIVES)
super(cask)
directives[:signal] = [*directives[:signal]].flatten.each_slice(2).to_a
directives[:signal] = Array(directives[:signal]).flatten.each_slice(2).to_a
@directives = directives
return unless directives.key?(:kext)
......@@ -49,7 +49,7 @@ module Cask
end
def summarize
to_h.flat_map { |key, val| [*val].map { |v| "#{key.inspect} => #{v.inspect}" } }.join(", ")
to_h.flat_map { |key, val| Array(val).map { |v| "#{key.inspect} => #{v.inspect}" } }.join(", ")
end
private
......
......@@ -18,7 +18,7 @@ module Cask
def initialize(**pairs)
pairs.assert_valid_keys!(*VALID_KEYS)
super(pairs.transform_values { |v| Set.new([*v]) })
super(pairs.transform_values { |v| Set.new(Array(v)) })
self.default = Set.new
end
......
......@@ -213,10 +213,11 @@ module Homebrew
end
def min_named(count_or_type)
if count_or_type.is_a?(Integer)
case count_or_type
when Integer
@min_named_args = count_or_type
@min_named_type = nil
elsif count_or_type.is_a?(Symbol)
when Symbol
@min_named_args = 1
@min_named_type = count_or_type
else
......@@ -225,10 +226,11 @@ module Homebrew
end
def named(count_or_type)
if count_or_type.is_a?(Integer)
case count_or_type
when Integer
@max_named_args = @min_named_args = count_or_type
@min_named_type = nil
elsif count_or_type.is_a?(Symbol)
when Symbol
@max_named_args = @min_named_args = 1
@min_named_type = count_or_type
else
......
......@@ -199,10 +199,11 @@ class Reporter
if paths.any? { |p| tap.cask_file?(p) }
# Currently only need to handle Cask deletion/migration.
if status == "D"
case status
when "D"
# Have a dedicated report array for deleted casks.
@report[:DC] << tap.formula_file_to_name(src)
elsif status == "M"
when "M"
# Report updated casks
@report[:MC] << tap.formula_file_to_name(src)
end
......
......@@ -274,7 +274,8 @@ module Homebrew
end
if forced_version && forced_version != "0"
if requested_spec == :stable
case requested_spec
when :stable
replacement_pairs << if File.read(formula.path).include?("version \"#{old_formula_version}\"")
[
old_formula_version.to_s,
......@@ -291,19 +292,20 @@ module Homebrew
"\\1\\2\\1version \"#{forced_version}\"\n",
]
end
elsif requested_spec == :devel
when :devel
replacement_pairs << [
/( devel do.+?version ")#{old_formula_version}("\n.+?end\n)/m,
"\\1#{forced_version}\\2",
]
end
elsif forced_version && forced_version == "0"
if requested_spec == :stable
case requested_spec
when :stable
replacement_pairs << [
/^ version "[\w.\-+]+"\n/m,
"",
]
elsif requested_spec == :devel
when :devel
replacement_pairs << [
/( devel do.+?)^ +version "[^\n]+"\n(.+?end\n)/m,
"\\1\\2",
......
......@@ -124,10 +124,11 @@ module Homebrew
ronn.close_write
ronn_output = ronn.read
odie "Got no output from ronn!" if ronn_output.blank?
if format_flag == "--markdown"
case format_flag
when "--markdown"
ronn_output = ronn_output.gsub(%r{<var>(.*?)</var>}, "*`\\1`*")
.gsub(/\n\n\n+/, "\n\n")
elsif format_flag == "--roff"
when "--roff"
ronn_output = ronn_output.gsub(%r{<code>(.*?)</code>}, "\\fB\\1\\fR")
.gsub(%r{<var>(.*?)</var>}, "\\fI\\1\\fR")
.gsub(/(^\[?\\fB.+): /, "\\1\n ")
......
......@@ -524,7 +524,7 @@ class ErrorDuringExecution < RuntimeError
redacted_cmd = redact_secrets(cmd.shelljoin.gsub('\=', "="), secrets)
s = +"Failure while executing; `#{redacted_cmd}` exited with #{exitstatus}."
unless [*output].empty?
if Array(output).present?
format_output_line = lambda do |type_line|
type, line = *type_line
if type == :stderr
......@@ -543,7 +543,7 @@ class ErrorDuringExecution < RuntimeError
end
def stderr
[*output].select { |type,| type == :stderr }.map(&:last).join
Array(output).select { |type,| type == :stderr }.map(&:last).join
end
end
......
......@@ -27,7 +27,7 @@ module Language
f = find_openjdk_formula(version)
return f.opt_libexec if f
req = JavaRequirement.new [*version]
req = JavaRequirement.new Array(version)
raise UnsatisfiedRequirements, req.message unless req.satisfied?
req.java_home
......
......@@ -262,7 +262,7 @@ module Language
# the contents of a `requirements.txt`.
# @return [void]
def pip_install(targets)
targets = [targets] unless targets.is_a? Array
targets = Array(targets)
targets.each do |t|
if t.respond_to? :stage
next if t.name == "homebrew-virtualenv"
......@@ -292,7 +292,7 @@ module Language
private
def do_install(targets)
targets = [targets] unless targets.is_a? Array
targets = Array(targets)
@formula.system @venv_root/"bin/pip", "install",
"-v", "--no-deps", "--no-binary", ":all:",
"--ignore-installed", *targets
......
......@@ -42,7 +42,7 @@ module OS
end
def languages
@languages ||= [*ENV["LANG"]&.slice(/[a-z]+/)].uniq
@languages ||= Array(ENV["LANG"]&.slice(/[a-z]+/)).uniq
end
def language
......
......@@ -29,7 +29,7 @@ class MacOSRequirement < Requirement
end
satisfy(build_env: false) do
next [*@version].any? { |v| MacOS.version.public_send(@comparator, v) } if version_specified?
next Array(@version).any? { |v| MacOS.version.public_send(@comparator, v) } if version_specified?
next true if OS.mac?
next true if @version
......
......@@ -19,7 +19,7 @@ module Searchable
def search_regex(regex)
select do |*args|
args = yield(*args) if block_given?
args = [*args].compact
args = Array(args).compact
args.any? { |arg| arg.match?(regex) }
end
end
......@@ -28,7 +28,7 @@ module Searchable
simplified_string = simplify_string(string)
select do |*args|
args = yield(*args) if block_given?
args = [*args].compact
args = Array(args).compact
args.any? { |arg| simplify_string(arg).include?(simplified_string) }
end
end
......
......@@ -61,7 +61,7 @@ class SystemCommand
@executable = executable
@args = args
@sudo = sudo
@input = [*input]
@input = Array(input)
@print_stdout = print_stdout
@print_stderr = print_stderr
@verbose = verbose
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment