Fix some auto-correctable type errors.
This commit is contained in:
parent
cf169e5270
commit
6750448d95
@ -213,7 +213,7 @@ begin
|
|||||||
args = Homebrew.install_args.parse
|
args = Homebrew.install_args.parse
|
||||||
Context.current = args.context
|
Context.current = args.context
|
||||||
|
|
||||||
error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io)
|
error_pipe = UNIXSocket.open(ENV.fetch("HOMEBREW_ERROR_PIPE"), &:recv_io)
|
||||||
error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
||||||
|
|
||||||
trap("INT", old_trap)
|
trap("INT", old_trap)
|
||||||
|
|||||||
@ -23,7 +23,7 @@ module Cask
|
|||||||
def run
|
def run
|
||||||
require "diagnostic"
|
require "diagnostic"
|
||||||
|
|
||||||
success = true
|
success = T.let(true, T::Boolean)
|
||||||
|
|
||||||
checks = Homebrew::Diagnostic::Checks.new(verbose: true)
|
checks = Homebrew::Diagnostic::Checks.new(verbose: true)
|
||||||
checks.cask_checks.each do |check|
|
checks.cask_checks.each do |check|
|
||||||
|
|||||||
@ -51,7 +51,7 @@ module Homebrew
|
|||||||
BuildEnvironment.dump ENV
|
BuildEnvironment.dump ENV
|
||||||
else
|
else
|
||||||
BuildEnvironment.keys(ENV).each do |key|
|
BuildEnvironment.keys(ENV).each do |key|
|
||||||
puts Utils::Shell.export_value(key, ENV[key], shell)
|
puts Utils::Shell.export_value(key, ENV.fetch(key), shell)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -261,8 +261,8 @@ module Homebrew
|
|||||||
|
|
||||||
formula_and_runtime_deps_names = [f.name] + f.runtime_dependencies.map(&:name)
|
formula_and_runtime_deps_names = [f.name] + f.runtime_dependencies.map(&:name)
|
||||||
keg = Keg.new(f.prefix)
|
keg = Keg.new(f.prefix)
|
||||||
relocatable = false
|
relocatable = T.let(false, T::Boolean)
|
||||||
skip_relocation = false
|
skip_relocation = T.let(false, T::Boolean)
|
||||||
|
|
||||||
keg.lock do
|
keg.lock do
|
||||||
original_tab = nil
|
original_tab = nil
|
||||||
@ -472,7 +472,7 @@ module Homebrew
|
|||||||
|
|
||||||
if args.write?
|
if args.write?
|
||||||
path = Pathname.new((HOMEBREW_REPOSITORY/bottle_hash["formula"]["path"]).to_s)
|
path = Pathname.new((HOMEBREW_REPOSITORY/bottle_hash["formula"]["path"]).to_s)
|
||||||
update_or_add = nil
|
update_or_add = T.let(nil, T.nilable(String))
|
||||||
|
|
||||||
Utils::Inreplace.inreplace(path) do |s|
|
Utils::Inreplace.inreplace(path) do |s|
|
||||||
if s.inreplace_string.include? "bottle do"
|
if s.inreplace_string.include? "bottle do"
|
||||||
|
|||||||
@ -93,7 +93,14 @@ module Homebrew
|
|||||||
srb_exec = %w[bundle exec srb tc]
|
srb_exec = %w[bundle exec srb tc]
|
||||||
srb_exec << "--error-black-list" << "5061"
|
srb_exec << "--error-black-list" << "5061"
|
||||||
srb_exec << "--quiet" if args.quiet?
|
srb_exec << "--quiet" if args.quiet?
|
||||||
srb_exec << "--autocorrect" if args.fix?
|
|
||||||
|
if args.fix?
|
||||||
|
# Auto-correcting method names is almost always wrong.
|
||||||
|
srb_exec << "--error-black-list" << "7003"
|
||||||
|
|
||||||
|
srb_exec << "--autocorrect"
|
||||||
|
end
|
||||||
|
|
||||||
srb_exec += ["--ignore", args.ignore] if args.ignore.present?
|
srb_exec += ["--ignore", args.ignore] if args.ignore.present?
|
||||||
if args.file.present? || args.dir.present?
|
if args.file.present? || args.dir.present?
|
||||||
cd("sorbet")
|
cd("sorbet")
|
||||||
|
|||||||
@ -234,7 +234,7 @@ class Migrator
|
|||||||
return unless old_cellar.exist?
|
return unless old_cellar.exist?
|
||||||
|
|
||||||
if new_cellar.exist?
|
if new_cellar.exist?
|
||||||
conflicted = false
|
conflicted = T.let(false, T::Boolean)
|
||||||
old_cellar.each_child do |c|
|
old_cellar.each_child do |c|
|
||||||
next unless (new_cellar/c.basename).exist?
|
next unless (new_cellar/c.basename).exist?
|
||||||
|
|
||||||
|
|||||||
@ -94,7 +94,7 @@ module Homebrew
|
|||||||
alias generic_disallowed_reason disallowed_reason
|
alias generic_disallowed_reason disallowed_reason
|
||||||
|
|
||||||
def tap_migration_reason(name)
|
def tap_migration_reason(name)
|
||||||
message = nil
|
message = T.let(nil, T.nilable(String))
|
||||||
|
|
||||||
Tap.each do |old_tap|
|
Tap.each do |old_tap|
|
||||||
new_tap = old_tap.tap_migrations[name]
|
new_tap = old_tap.tap_migrations[name]
|
||||||
|
|||||||
@ -12,7 +12,7 @@ require "cmd/postinstall"
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
args = Homebrew.postinstall_args.parse
|
args = Homebrew.postinstall_args.parse
|
||||||
error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io)
|
error_pipe = UNIXSocket.open(ENV.fetch("HOMEBREW_ERROR_PIPE"), &:recv_io)
|
||||||
error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
||||||
|
|
||||||
trap("INT", old_trap)
|
trap("INT", old_trap)
|
||||||
|
|||||||
@ -10,7 +10,7 @@ require "cask/cask_loader"
|
|||||||
module Readall
|
module Readall
|
||||||
class << self
|
class << self
|
||||||
def valid_ruby_syntax?(ruby_files)
|
def valid_ruby_syntax?(ruby_files)
|
||||||
failed = false
|
failed = T.let(false, T::Boolean)
|
||||||
ruby_files.each do |ruby_file|
|
ruby_files.each do |ruby_file|
|
||||||
# As a side effect, print syntax errors/warnings to `$stderr`.
|
# As a side effect, print syntax errors/warnings to `$stderr`.
|
||||||
failed = true if syntax_errors_or_warnings?(ruby_file)
|
failed = true if syntax_errors_or_warnings?(ruby_file)
|
||||||
@ -21,7 +21,7 @@ module Readall
|
|||||||
def valid_aliases?(alias_dir, formula_dir)
|
def valid_aliases?(alias_dir, formula_dir)
|
||||||
return true unless alias_dir.directory?
|
return true unless alias_dir.directory?
|
||||||
|
|
||||||
failed = false
|
failed = T.let(false, T::Boolean)
|
||||||
alias_dir.each_child do |f|
|
alias_dir.each_child do |f|
|
||||||
if !f.symlink?
|
if !f.symlink?
|
||||||
onoe "Non-symlink alias: #{f}"
|
onoe "Non-symlink alias: #{f}"
|
||||||
@ -40,7 +40,7 @@ module Readall
|
|||||||
end
|
end
|
||||||
|
|
||||||
def valid_formulae?(formulae)
|
def valid_formulae?(formulae)
|
||||||
success = true
|
success = T.let(true, T::Boolean)
|
||||||
formulae.each do |file|
|
formulae.each do |file|
|
||||||
Formulary.factory(file)
|
Formulary.factory(file)
|
||||||
rescue Interrupt
|
rescue Interrupt
|
||||||
@ -54,7 +54,7 @@ module Readall
|
|||||||
end
|
end
|
||||||
|
|
||||||
def valid_casks?(casks)
|
def valid_casks?(casks)
|
||||||
success = true
|
success = T.let(true, T::Boolean)
|
||||||
casks.each do |file|
|
casks.each do |file|
|
||||||
Cask::CaskLoader.load(file)
|
Cask::CaskLoader.load(file)
|
||||||
rescue Interrupt
|
rescue Interrupt
|
||||||
|
|||||||
@ -46,7 +46,7 @@ module RuboCop
|
|||||||
|
|
||||||
next if node.nil?
|
next if node.nil?
|
||||||
|
|
||||||
reason_found = false
|
reason_found = T.let(false, T::Boolean)
|
||||||
reason(node) do |reason_node|
|
reason(node) do |reason_node|
|
||||||
reason_found = true
|
reason_found = true
|
||||||
next if reason_node.sym_type?
|
next if reason_node.sym_type?
|
||||||
|
|||||||
@ -20,7 +20,7 @@ begin
|
|||||||
args = Homebrew.test_args.parse
|
args = Homebrew.test_args.parse
|
||||||
Context.current = args.context
|
Context.current = args.context
|
||||||
|
|
||||||
error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io)
|
error_pipe = UNIXSocket.open(ENV.fetch("HOMEBREW_ERROR_PIPE"), &:recv_io)
|
||||||
error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
||||||
|
|
||||||
trap("INT", old_trap)
|
trap("INT", old_trap)
|
||||||
|
|||||||
@ -34,7 +34,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
exit! 1 # never gets here unless exec failed
|
exit! 1 # never gets here unless exec failed
|
||||||
end
|
end
|
||||||
Process.wait(pid)
|
Process.wait(T.must(pid))
|
||||||
$CHILD_STATUS.success?
|
$CHILD_STATUS.success?
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -58,10 +58,13 @@ module Homebrew
|
|||||||
method = instance_method(name)
|
method = instance_method(name)
|
||||||
define_method(name) do |*args, &block|
|
define_method(name) do |*args, &block|
|
||||||
time = Time.now
|
time = Time.now
|
||||||
method.bind(self).call(*args, &block)
|
|
||||||
ensure
|
begin
|
||||||
$times[name] ||= 0
|
method.bind(self).call(*args, &block)
|
||||||
$times[name] += Time.now - time
|
ensure
|
||||||
|
$times[name] ||= 0
|
||||||
|
$times[name] += Time.now - time
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -190,7 +193,7 @@ module Kernel
|
|||||||
line.include?("/.metadata/")
|
line.include?("/.metadata/")
|
||||||
end
|
end
|
||||||
|
|
||||||
tap_message = nil
|
tap_message = T.let(nil, T.nilable(String))
|
||||||
|
|
||||||
backtrace.each do |line|
|
backtrace.each do |line|
|
||||||
next unless match = line.match(HOMEBREW_TAP_PATH_REGEX)
|
next unless match = line.match(HOMEBREW_TAP_PATH_REGEX)
|
||||||
@ -263,12 +266,12 @@ module Kernel
|
|||||||
ENV["HOMEBREW_DEBUG_INSTALL"] = f.full_name
|
ENV["HOMEBREW_DEBUG_INSTALL"] = f.full_name
|
||||||
end
|
end
|
||||||
|
|
||||||
if ENV["SHELL"].include?("zsh") && ENV["HOME"].start_with?(HOMEBREW_TEMP.resolved_path.to_s)
|
if ENV["SHELL"].include?("zsh") && (home = ENV["HOME"])&.start_with?(HOMEBREW_TEMP.resolved_path.to_s)
|
||||||
FileUtils.mkdir_p ENV["HOME"]
|
FileUtils.mkdir_p home
|
||||||
FileUtils.touch "#{ENV["HOME"]}/.zshrc"
|
FileUtils.touch "#{home}/.zshrc"
|
||||||
end
|
end
|
||||||
|
|
||||||
Process.wait fork { exec ENV["SHELL"] }
|
Process.wait fork { exec ENV.fetch("SHELL") }
|
||||||
|
|
||||||
return if $CHILD_STATUS.success?
|
return if $CHILD_STATUS.success?
|
||||||
raise "Aborted due to non-zero exit status (#{$CHILD_STATUS.exitstatus})" if $CHILD_STATUS.exited?
|
raise "Aborted due to non-zero exit status (#{$CHILD_STATUS.exitstatus})" if $CHILD_STATUS.exited?
|
||||||
|
|||||||
@ -58,7 +58,7 @@ module Utils
|
|||||||
"--silent", "--output", "/dev/null",
|
"--silent", "--output", "/dev/null",
|
||||||
"https://www.google-analytics.com/collect"
|
"https://www.google-analytics.com/collect"
|
||||||
end
|
end
|
||||||
Process.detach pid
|
Process.detach T.must(pid)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ module Utils
|
|||||||
begin
|
begin
|
||||||
socket = server.accept_nonblock
|
socket = server.accept_nonblock
|
||||||
rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR
|
rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR
|
||||||
retry unless Process.waitpid(pid, Process::WNOHANG)
|
retry unless Process.waitpid(T.must(pid), Process::WNOHANG)
|
||||||
else
|
else
|
||||||
socket.send_io(write)
|
socket.send_io(write)
|
||||||
socket.close
|
socket.close
|
||||||
@ -72,7 +72,7 @@ module Utils
|
|||||||
write.close
|
write.close
|
||||||
data = read.read
|
data = read.read
|
||||||
read.close
|
read.close
|
||||||
Process.wait(pid) unless socket.nil?
|
Process.wait(T.must(pid)) unless socket.nil?
|
||||||
|
|
||||||
# 130 is the exit status for a process interrupted via Ctrl-C.
|
# 130 is the exit status for a process interrupted via Ctrl-C.
|
||||||
# We handle it here because of the possibility of an interrupted process terminating
|
# We handle it here because of the possibility of an interrupted process terminating
|
||||||
@ -80,7 +80,7 @@ module Utils
|
|||||||
raise Interrupt if $CHILD_STATUS.exitstatus == 130
|
raise Interrupt if $CHILD_STATUS.exitstatus == 130
|
||||||
|
|
||||||
if data && !data.empty?
|
if data && !data.empty?
|
||||||
error_hash = JSON.parse(data.lines.first)
|
error_hash = JSON.parse(T.must(data.lines.first))
|
||||||
|
|
||||||
e = ChildProcessError.new(error_hash)
|
e = ChildProcessError.new(error_hash)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user