Fix Style/ObjectThen offences
This commit is contained in:
parent
8500c26419
commit
f5dc7a571f
@ -225,7 +225,7 @@ class URL < Delegator
|
|||||||
@raw_interpolated_url =
|
@raw_interpolated_url =
|
||||||
Pathname(@caller_location.absolute_path)
|
Pathname(@caller_location.absolute_path)
|
||||||
.each_line.drop(@caller_location.lineno - 1)
|
.each_line.drop(@caller_location.lineno - 1)
|
||||||
.first&.yield_self { |line| line[/url\s+"([^"]+)"/, 1] }
|
.first&.then { |line| line[/url\s+"([^"]+)"/, 1] }
|
||||||
end
|
end
|
||||||
private :raw_interpolated_url
|
private :raw_interpolated_url
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ module Homebrew
|
|||||||
def cleanup
|
def cleanup
|
||||||
args = cleanup_args.parse
|
args = cleanup_args.parse
|
||||||
|
|
||||||
days = args.prune.presence&.yield_self do |prune|
|
days = args.prune.presence&.then do |prune|
|
||||||
case prune
|
case prune
|
||||||
when /\A\d+\Z/
|
when /\A\d+\Z/
|
||||||
prune.to_i
|
prune.to_i
|
||||||
|
|||||||
@ -121,7 +121,7 @@ module Homebrew
|
|||||||
# TODO: 3.6.0: odeprecate not specifying args.all?, require args.installed?
|
# TODO: 3.6.0: odeprecate not specifying args.all?, require args.installed?
|
||||||
|
|
||||||
audit_formulae, audit_casks = if args.tap
|
audit_formulae, audit_casks = if args.tap
|
||||||
Tap.fetch(args.tap).yield_self do |tap|
|
Tap.fetch(args.tap).then do |tap|
|
||||||
[
|
[
|
||||||
tap.formula_names.map { |name| Formula[name] },
|
tap.formula_names.map { |name| Formula[name] },
|
||||||
tap.cask_files.map { |path| Cask::CaskLoader.load(path) },
|
tap.cask_files.map { |path| Cask::CaskLoader.load(path) },
|
||||||
|
|||||||
@ -98,7 +98,7 @@ module Homebrew
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
last_check_time = state["check_time"]&.yield_self { |t| Time.parse(t) }
|
last_check_time = state["check_time"]&.then { |t| Time.parse(t) }
|
||||||
|
|
||||||
check_time = Time.now
|
check_time = Time.now
|
||||||
if last_check_time && check_time < (last_check_time + 1.day)
|
if last_check_time && check_time < (last_check_time + 1.day)
|
||||||
@ -107,7 +107,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
last_sha256 = state["sha256"]
|
last_sha256 = state["sha256"]
|
||||||
last_time = state["time"]&.yield_self { |t| Time.parse(t) }
|
last_time = state["time"]&.then { |t| Time.parse(t) }
|
||||||
last_file_size = state["file_size"]
|
last_file_size = state["file_size"]
|
||||||
|
|
||||||
download = Cask::Download.new(cask)
|
download = Cask::Download.new(cask)
|
||||||
|
|||||||
@ -52,7 +52,7 @@ module Homebrew
|
|||||||
if (macos = args.macos&.compact_blank) && macos.present?
|
if (macos = args.macos&.compact_blank) && macos.present?
|
||||||
runners += macos.map do |element|
|
runners += macos.map do |element|
|
||||||
# We accept runner name syntax (11-arm64) or bottle syntax (arm64_big_sur)
|
# We accept runner name syntax (11-arm64) or bottle syntax (arm64_big_sur)
|
||||||
os, arch = element.yield_self do |s|
|
os, arch = element.then do |s|
|
||||||
tag = Utils::Bottles::Tag.from_symbol(s.to_sym)
|
tag = Utils::Bottles::Tag.from_symbol(s.to_sym)
|
||||||
[tag.to_macos_version, tag.arch]
|
[tag.to_macos_version, tag.arch]
|
||||||
rescue ArgumentError, MacOSVersionError
|
rescue ArgumentError, MacOSVersionError
|
||||||
|
|||||||
@ -110,7 +110,7 @@ module Homebrew
|
|||||||
version ||= item.elements["version"]&.text&.strip
|
version ||= item.elements["version"]&.text&.strip
|
||||||
|
|
||||||
title = item.elements["title"]&.text&.strip
|
title = item.elements["title"]&.text&.strip
|
||||||
pub_date = item.elements["pubDate"]&.text&.strip&.presence&.yield_self do |date_string|
|
pub_date = item.elements["pubDate"]&.text&.strip&.presence&.then do |date_string|
|
||||||
Time.parse(date_string)
|
Time.parse(date_string)
|
||||||
rescue ArgumentError
|
rescue ArgumentError
|
||||||
# Omit unparseable strings (e.g. non-English dates)
|
# Omit unparseable strings (e.g. non-English dates)
|
||||||
|
|||||||
@ -56,7 +56,7 @@ HOMEBREW_CACHE_FORMULA = (HOMEBREW_CACHE/"Formula").freeze
|
|||||||
HOMEBREW_LOGS = Pathname(EnvVar["HOMEBREW_LOGS"]).expand_path.freeze
|
HOMEBREW_LOGS = Pathname(EnvVar["HOMEBREW_LOGS"]).expand_path.freeze
|
||||||
|
|
||||||
# Must use `/tmp` instead of `TMPDIR` because long paths break Unix domain sockets
|
# Must use `/tmp` instead of `TMPDIR` because long paths break Unix domain sockets
|
||||||
HOMEBREW_TEMP = Pathname(EnvVar["HOMEBREW_TEMP"]).yield_self do |tmp|
|
HOMEBREW_TEMP = Pathname(EnvVar["HOMEBREW_TEMP"]).then do |tmp|
|
||||||
tmp.mkpath unless tmp.exist?
|
tmp.mkpath unless tmp.exist?
|
||||||
tmp.realpath
|
tmp.realpath
|
||||||
end.freeze
|
end.freeze
|
||||||
|
|||||||
@ -130,7 +130,7 @@ module Homebrew
|
|||||||
Dir.mktmpdir do |dir|
|
Dir.mktmpdir do |dir|
|
||||||
dir = Pathname(dir)
|
dir = Pathname(dir)
|
||||||
|
|
||||||
installer.yield_self do |i|
|
installer.then do |i|
|
||||||
i.extract_primary_container(to: dir)
|
i.extract_primary_container(to: dir)
|
||||||
rescue ErrorDuringExecution => e
|
rescue ErrorDuringExecution => e
|
||||||
onoe e
|
onoe e
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user