From d04430d1a57896e3c055b42f73e70144afb85f00 Mon Sep 17 00:00:00 2001 From: Patrick Linnane Date: Tue, 26 Nov 2024 11:50:45 -0800 Subject: [PATCH] `brew style --fix` Signed-off-by: Patrick Linnane --- Library/Homebrew/cask/upgrade.rb | 1 - Library/Homebrew/cask/url.rb | 1 - Library/Homebrew/descriptions.rb | 1 - Library/Homebrew/extend/kernel.rb | 4 ++-- Library/Homebrew/livecheck.rb | 3 --- Library/Homebrew/utils/analytics.rb | 2 +- Library/Homebrew/utils/curl.rb | 4 ++-- Library/Homebrew/utils/popen.rb | 2 +- Library/Homebrew/utils/pypi.rb | 1 - 9 files changed, 6 insertions(+), 13 deletions(-) diff --git a/Library/Homebrew/cask/upgrade.rb b/Library/Homebrew/cask/upgrade.rb index 89dade90e9..6e60b2415a 100644 --- a/Library/Homebrew/cask/upgrade.rb +++ b/Library/Homebrew/cask/upgrade.rb @@ -38,7 +38,6 @@ module Cask quarantine: nil, require_sha: nil ) - quarantine = true if quarantine.nil? greedy = true if Homebrew::EnvConfig.upgrade_greedy? diff --git a/Library/Homebrew/cask/url.rb b/Library/Homebrew/cask/url.rb index 0fc7ead73f..5bcee1de9f 100644 --- a/Library/Homebrew/cask/url.rb +++ b/Library/Homebrew/cask/url.rb @@ -74,7 +74,6 @@ module Cask data: nil, only_path: nil ) - @uri = URI(uri) header = Array(header) unless header.nil? diff --git a/Library/Homebrew/descriptions.rb b/Library/Homebrew/descriptions.rb index 63b28cefa8..ecda434573 100644 --- a/Library/Homebrew/descriptions.rb +++ b/Library/Homebrew/descriptions.rb @@ -10,7 +10,6 @@ class Descriptions # Given a regex, find all formulae whose specified fields contain a match. def self.search(string_or_regex, field, cache_store, eval_all = Homebrew::EnvConfig.eval_all?, cache_store_hash: false) - cache_store.populate_if_empty!(eval_all:) unless cache_store_hash results = case field diff --git a/Library/Homebrew/extend/kernel.rb b/Library/Homebrew/extend/kernel.rb index 50484d47de..89e3723b90 100644 --- a/Library/Homebrew/extend/kernel.rb +++ b/Library/Homebrew/extend/kernel.rb @@ -285,8 +285,8 @@ module Kernel Homebrew._system(cmd, *args) do # Redirect output streams to `/dev/null` instead of closing as some programs # will fail to execute if they can't write to an open stream. - $stdout.reopen("/dev/null") - $stderr.reopen("/dev/null") + $stdout.reopen(File::NULL) + $stderr.reopen(File::NULL) end end diff --git a/Library/Homebrew/livecheck.rb b/Library/Homebrew/livecheck.rb index 363fdfc65c..1e188e17e2 100644 --- a/Library/Homebrew/livecheck.rb +++ b/Library/Homebrew/livecheck.rb @@ -178,10 +178,7 @@ class Livecheck delegate version: :@package_or_resource delegate arch: :@package_or_resource # FIXME: false positive: https://github.com/rubocop/rubocop/issues/13453 - # rubocop:disable Style/AccessModifierDeclarations private :version, :arch - # rubocop:enable Style/AccessModifierDeclarations - # Returns a `Hash` of all instance variable values. # @return [Hash] sig { returns(T::Hash[String, T.untyped]) } diff --git a/Library/Homebrew/utils/analytics.rb b/Library/Homebrew/utils/analytics.rb index b4c8f4ec3b..cbf79f1f67 100644 --- a/Library/Homebrew/utils/analytics.rb +++ b/Library/Homebrew/utils/analytics.rb @@ -54,7 +54,7 @@ module Utils require "utils/curl" curl = Utils::Curl.curl_executable - args = Utils::Curl.curl_args(*args, "--silent", "--output", "/dev/null", show_error: false) + args = Utils::Curl.curl_args(*args, "--silent", "--output", File::NULL, show_error: false) if ENV["HOMEBREW_ANALYTICS_DEBUG"] puts "#{curl} #{args.join(" ")} \"#{url}\"" puts Utils.popen_read(curl, *args, url) diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index 4a5a3abedb..39b0a8fc72 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -101,7 +101,7 @@ module Utils end # echo any cookies received on a redirect - args << "--cookie" << "/dev/null" + args << "--cookie" << File::NULL args << "--globoff" @@ -256,7 +256,7 @@ module Utils if request_args.empty? # If we didn't get any wanted header yet, retry using `GET`. next if wanted_headers.any? && - parsed_output.fetch(:responses).none? { |r| (r.fetch(:headers).keys & wanted_headers).any? } + parsed_output.fetch(:responses).none? { |r| r.fetch(:headers).keys.intersect?(wanted_headers) } # Some CDNs respond with 400 codes for `HEAD` but resolve with `GET`. next if (400..499).cover?(parsed_output.fetch(:responses).last&.fetch(:status_code).to_i) diff --git a/Library/Homebrew/utils/popen.rb b/Library/Homebrew/utils/popen.rb index fea4d9831a..a270ac01c6 100644 --- a/Library/Homebrew/utils/popen.rb +++ b/Library/Homebrew/utils/popen.rb @@ -50,7 +50,7 @@ module Utils yield pipe else - options[:err] ||= "/dev/null" unless ENV["HOMEBREW_STDERR"] + options[:err] ||= File::NULL unless ENV["HOMEBREW_STDERR"] begin exec(*args, options) rescue Errno::ENOENT diff --git a/Library/Homebrew/utils/pypi.rb b/Library/Homebrew/utils/pypi.rb index 083108b28a..18487c31c7 100644 --- a/Library/Homebrew/utils/pypi.rb +++ b/Library/Homebrew/utils/pypi.rb @@ -219,7 +219,6 @@ module PyPI exclude_packages: nil, dependencies: nil, install_dependencies: false, print_only: false, silent: false, verbose: false, ignore_non_pypi_packages: false) - auto_update_list = formula.tap&.pypi_formula_mappings if auto_update_list.present? && auto_update_list.key?(formula.full_name) && package_name.blank? && extra_packages.blank? && exclude_packages.blank?