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
|
||||
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)
|
||||
|
||||
trap("INT", old_trap)
|
||||
|
||||
@ -23,7 +23,7 @@ module Cask
|
||||
def run
|
||||
require "diagnostic"
|
||||
|
||||
success = true
|
||||
success = T.let(true, T::Boolean)
|
||||
|
||||
checks = Homebrew::Diagnostic::Checks.new(verbose: true)
|
||||
checks.cask_checks.each do |check|
|
||||
|
||||
@ -51,7 +51,7 @@ module Homebrew
|
||||
BuildEnvironment.dump ENV
|
||||
else
|
||||
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
|
||||
|
||||
@ -261,8 +261,8 @@ module Homebrew
|
||||
|
||||
formula_and_runtime_deps_names = [f.name] + f.runtime_dependencies.map(&:name)
|
||||
keg = Keg.new(f.prefix)
|
||||
relocatable = false
|
||||
skip_relocation = false
|
||||
relocatable = T.let(false, T::Boolean)
|
||||
skip_relocation = T.let(false, T::Boolean)
|
||||
|
||||
keg.lock do
|
||||
original_tab = nil
|
||||
@ -472,7 +472,7 @@ module Homebrew
|
||||
|
||||
if args.write?
|
||||
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|
|
||||
if s.inreplace_string.include? "bottle do"
|
||||
|
||||
@ -93,7 +93,14 @@ module Homebrew
|
||||
srb_exec = %w[bundle exec srb tc]
|
||||
srb_exec << "--error-black-list" << "5061"
|
||||
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?
|
||||
if args.file.present? || args.dir.present?
|
||||
cd("sorbet")
|
||||
|
||||
@ -234,7 +234,7 @@ class Migrator
|
||||
return unless old_cellar.exist?
|
||||
|
||||
if new_cellar.exist?
|
||||
conflicted = false
|
||||
conflicted = T.let(false, T::Boolean)
|
||||
old_cellar.each_child do |c|
|
||||
next unless (new_cellar/c.basename).exist?
|
||||
|
||||
|
||||
@ -94,7 +94,7 @@ module Homebrew
|
||||
alias generic_disallowed_reason disallowed_reason
|
||||
|
||||
def tap_migration_reason(name)
|
||||
message = nil
|
||||
message = T.let(nil, T.nilable(String))
|
||||
|
||||
Tap.each do |old_tap|
|
||||
new_tap = old_tap.tap_migrations[name]
|
||||
|
||||
@ -12,7 +12,7 @@ require "cmd/postinstall"
|
||||
|
||||
begin
|
||||
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)
|
||||
|
||||
trap("INT", old_trap)
|
||||
|
||||
@ -10,7 +10,7 @@ require "cask/cask_loader"
|
||||
module Readall
|
||||
class << self
|
||||
def valid_ruby_syntax?(ruby_files)
|
||||
failed = false
|
||||
failed = T.let(false, T::Boolean)
|
||||
ruby_files.each do |ruby_file|
|
||||
# As a side effect, print syntax errors/warnings to `$stderr`.
|
||||
failed = true if syntax_errors_or_warnings?(ruby_file)
|
||||
@ -21,7 +21,7 @@ module Readall
|
||||
def valid_aliases?(alias_dir, formula_dir)
|
||||
return true unless alias_dir.directory?
|
||||
|
||||
failed = false
|
||||
failed = T.let(false, T::Boolean)
|
||||
alias_dir.each_child do |f|
|
||||
if !f.symlink?
|
||||
onoe "Non-symlink alias: #{f}"
|
||||
@ -40,7 +40,7 @@ module Readall
|
||||
end
|
||||
|
||||
def valid_formulae?(formulae)
|
||||
success = true
|
||||
success = T.let(true, T::Boolean)
|
||||
formulae.each do |file|
|
||||
Formulary.factory(file)
|
||||
rescue Interrupt
|
||||
@ -54,7 +54,7 @@ module Readall
|
||||
end
|
||||
|
||||
def valid_casks?(casks)
|
||||
success = true
|
||||
success = T.let(true, T::Boolean)
|
||||
casks.each do |file|
|
||||
Cask::CaskLoader.load(file)
|
||||
rescue Interrupt
|
||||
|
||||
@ -46,7 +46,7 @@ module RuboCop
|
||||
|
||||
next if node.nil?
|
||||
|
||||
reason_found = false
|
||||
reason_found = T.let(false, T::Boolean)
|
||||
reason(node) do |reason_node|
|
||||
reason_found = true
|
||||
next if reason_node.sym_type?
|
||||
|
||||
@ -20,7 +20,7 @@ begin
|
||||
args = Homebrew.test_args.parse
|
||||
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)
|
||||
|
||||
trap("INT", old_trap)
|
||||
|
||||
@ -34,7 +34,7 @@ module Homebrew
|
||||
end
|
||||
exit! 1 # never gets here unless exec failed
|
||||
end
|
||||
Process.wait(pid)
|
||||
Process.wait(T.must(pid))
|
||||
$CHILD_STATUS.success?
|
||||
end
|
||||
|
||||
@ -58,10 +58,13 @@ module Homebrew
|
||||
method = instance_method(name)
|
||||
define_method(name) do |*args, &block|
|
||||
time = Time.now
|
||||
method.bind(self).call(*args, &block)
|
||||
ensure
|
||||
$times[name] ||= 0
|
||||
$times[name] += Time.now - time
|
||||
|
||||
begin
|
||||
method.bind(self).call(*args, &block)
|
||||
ensure
|
||||
$times[name] ||= 0
|
||||
$times[name] += Time.now - time
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -190,7 +193,7 @@ module Kernel
|
||||
line.include?("/.metadata/")
|
||||
end
|
||||
|
||||
tap_message = nil
|
||||
tap_message = T.let(nil, T.nilable(String))
|
||||
|
||||
backtrace.each do |line|
|
||||
next unless match = line.match(HOMEBREW_TAP_PATH_REGEX)
|
||||
@ -263,12 +266,12 @@ module Kernel
|
||||
ENV["HOMEBREW_DEBUG_INSTALL"] = f.full_name
|
||||
end
|
||||
|
||||
if ENV["SHELL"].include?("zsh") && ENV["HOME"].start_with?(HOMEBREW_TEMP.resolved_path.to_s)
|
||||
FileUtils.mkdir_p ENV["HOME"]
|
||||
FileUtils.touch "#{ENV["HOME"]}/.zshrc"
|
||||
if ENV["SHELL"].include?("zsh") && (home = ENV["HOME"])&.start_with?(HOMEBREW_TEMP.resolved_path.to_s)
|
||||
FileUtils.mkdir_p home
|
||||
FileUtils.touch "#{home}/.zshrc"
|
||||
end
|
||||
|
||||
Process.wait fork { exec ENV["SHELL"] }
|
||||
Process.wait fork { exec ENV.fetch("SHELL") }
|
||||
|
||||
return if $CHILD_STATUS.success?
|
||||
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",
|
||||
"https://www.google-analytics.com/collect"
|
||||
end
|
||||
Process.detach pid
|
||||
Process.detach T.must(pid)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ module Utils
|
||||
begin
|
||||
socket = server.accept_nonblock
|
||||
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
|
||||
socket.send_io(write)
|
||||
socket.close
|
||||
@ -72,7 +72,7 @@ module Utils
|
||||
write.close
|
||||
data = read.read
|
||||
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.
|
||||
# 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
|
||||
|
||||
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)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user