diff --git a/Library/Homebrew/bundle/commands/exec.rb b/Library/Homebrew/bundle/commands/exec.rb index 0089f50ef3..15968bbba0 100644 --- a/Library/Homebrew/bundle/commands/exec.rb +++ b/Library/Homebrew/bundle/commands/exec.rb @@ -123,11 +123,11 @@ module Homebrew ENV[key] = if key.include?("PATH") && value.match?(PATH_LIKE_ENV_REGEX) rejected_opts = [] path = PATH.new(ENV.fetch("PATH")) - .reject do |value| - rejected_opts << value if value.match?(opt) + .reject do |path_value| + rejected_opts << path_value if path_value.match?(opt) end - rejected_opts.each do |value| - path.prepend(value.gsub(opt, cellar)) + rejected_opts.each do |path_value| + path.prepend(path_value.gsub(opt, cellar)) end path.to_s else diff --git a/Library/Homebrew/cmd/services.rb b/Library/Homebrew/cmd/services.rb index 5de936c051..f072813778 100644 --- a/Library/Homebrew/cmd/services.rb +++ b/Library/Homebrew/cmd/services.rb @@ -64,7 +64,7 @@ module Homebrew sig { override.void } def run # pbpaste's exit status is a proxy for detecting the use of reattach-to-user-namespace - if ENV["HOMEBREW_TMUX"] && (File.exist?("/usr/bin/pbpaste") && !quiet_system("/usr/bin/pbpaste")) + if ENV.fetch("HOMEBREW_TMUX", nil) && File.exist?("/usr/bin/pbpaste") && !quiet_system("/usr/bin/pbpaste") raise UsageError, "`brew services` cannot run under tmux!" end diff --git a/Library/Homebrew/livecheck/livecheck.rb b/Library/Homebrew/livecheck/livecheck.rb index 8370b23c59..38042e74de 100644 --- a/Library/Homebrew/livecheck/livecheck.rb +++ b/Library/Homebrew/livecheck/livecheck.rb @@ -370,9 +370,9 @@ module Homebrew progress&.increment info.delete(:meta) unless verbose if check_for_resources && !verbose - resource_version_info.map! do |info| - info.delete(:meta) - info + resource_version_info.map! do |resource_info| + resource_info.delete(:meta) + resource_info end end next info diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index 8d9d99f366..45c0943736 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -62,7 +62,7 @@ module Homebrew shell_scripts else path.glob("**/*.sh") - .reject { |path| path.to_s.include?("/vendor/") || path.directory? } + .reject { |file_path| file_path.to_s.include?("/vendor/") || file_path.directory? } end actionlint_files += (path/".github/workflows").glob("*.y{,a}ml") end diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index 0fb62364a1..b1f7643c6b 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -442,7 +442,7 @@ module Utils end if url.start_with?("https://") && Homebrew::EnvConfig.no_insecure_redirect? && - (details[:final_url].present? && !details[:final_url].start_with?("https://")) + details[:final_url].present? && !details[:final_url].start_with?("https://") return "The #{url_type} #{url} redirects back to HTTP" end @@ -459,7 +459,7 @@ module Utils http_with_https_available = url.start_with?("http://") && - (secure_details[:final_url].present? && secure_details[:final_url].start_with?("https://")) + secure_details[:final_url].present? && secure_details[:final_url].start_with?("https://") if (etag_match || content_length_match || file_match) && http_with_https_available return "The #{url_type} #{url} should use HTTPS rather than HTTP" @@ -472,7 +472,7 @@ module Utils https_content = secure_details[:file]&.scrub&.gsub(no_protocol_file_contents, "/") # Check for the same content after removing all protocols - if (http_content && https_content) && (http_content == https_content) && http_with_https_available + if http_content && https_content && (http_content == https_content) && http_with_https_available return "The #{url_type} #{url} should use HTTPS rather than HTTP" end