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)
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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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