fix new offenses

Signed-off-by: Patrick Linnane <patrick@linnane.io>
This commit is contained in:
Patrick Linnane 2025-03-26 11:00:11 -07:00 committed by Bo Anderson
parent 656ad07548
commit 9821a7e896
No known key found for this signature in database
5 changed files with 12 additions and 12 deletions

View File

@ -123,11 +123,11 @@ module Homebrew
ENV[key] = if key.include?("PATH") && value.match?(PATH_LIKE_ENV_REGEX) ENV[key] = if key.include?("PATH") && value.match?(PATH_LIKE_ENV_REGEX)
rejected_opts = [] rejected_opts = []
path = PATH.new(ENV.fetch("PATH")) path = PATH.new(ENV.fetch("PATH"))
.reject do |value| .reject do |path_value|
rejected_opts << value if value.match?(opt) rejected_opts << path_value if path_value.match?(opt)
end end
rejected_opts.each do |value| rejected_opts.each do |path_value|
path.prepend(value.gsub(opt, cellar)) path.prepend(path_value.gsub(opt, cellar))
end end
path.to_s path.to_s
else else

View File

@ -64,7 +64,7 @@ module Homebrew
sig { override.void } sig { override.void }
def run def run
# pbpaste's exit status is a proxy for detecting the use of reattach-to-user-namespace # 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, raise UsageError,
"`brew services` cannot run under tmux!" "`brew services` cannot run under tmux!"
end end

View File

@ -370,9 +370,9 @@ module Homebrew
progress&.increment progress&.increment
info.delete(:meta) unless verbose info.delete(:meta) unless verbose
if check_for_resources && !verbose if check_for_resources && !verbose
resource_version_info.map! do |info| resource_version_info.map! do |resource_info|
info.delete(:meta) resource_info.delete(:meta)
info resource_info
end end
end end
next info next info

View File

@ -62,7 +62,7 @@ module Homebrew
shell_scripts shell_scripts
else else
path.glob("**/*.sh") 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 end
actionlint_files += (path/".github/workflows").glob("*.y{,a}ml") actionlint_files += (path/".github/workflows").glob("*.y{,a}ml")
end end

View File

@ -442,7 +442,7 @@ module Utils
end end
if url.start_with?("https://") && Homebrew::EnvConfig.no_insecure_redirect? && 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" return "The #{url_type} #{url} redirects back to HTTP"
end end
@ -459,7 +459,7 @@ module Utils
http_with_https_available = http_with_https_available =
url.start_with?("http://") && 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 if (etag_match || content_length_match || file_match) && http_with_https_available
return "The #{url_type} #{url} should use HTTPS rather than HTTP" 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, "/") https_content = secure_details[:file]&.scrub&.gsub(no_protocol_file_contents, "/")
# Check for the same content after removing all protocols # 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" return "The #{url_type} #{url} should use HTTPS rather than HTTP"
end end