Skip to content

Commit

Permalink
brew style --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcQuaid committed Mar 7, 2024
1 parent a096658 commit 28e5cde
Show file tree
Hide file tree
Showing 237 changed files with 1,137 additions and 1,144 deletions.
2 changes: 1 addition & 1 deletion Library/Homebrew/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def self.fetch_json_api_file(endpoint, target: HOMEBREW_CACHE_API/endpoint,
end

mtime = insecure_download ? Time.new(1970, 1, 1) : Time.now
FileUtils.touch(target, mtime: mtime) unless skip_download
FileUtils.touch(target, mtime:) unless skip_download
JSON.parse(target.read, freeze: true)
rescue JSON::ParserError
target.unlink
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/api/cask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def self.all_renames
def self.write_names(regenerate: false)
download_and_cache_data! unless cache.key?("casks")

Homebrew::API.write_names_file(all_casks.keys, "cask", regenerate: regenerate)
Homebrew::API.write_names_file(all_casks.keys, "cask", regenerate:)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/api/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def self.tap_git_head
def self.write_names_and_aliases(regenerate: false)
download_and_cache_data! unless cache.key?("formulae")

return unless Homebrew::API.write_names_file(all_formulae.keys, "formula", regenerate: regenerate)
return unless Homebrew::API.write_names_file(all_formulae.keys, "formula", regenerate:)

(HOMEBREW_CACHE_API/"formula_aliases.txt").open("w") do |file|
all_aliases.each do |alias_name, real_name|
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/brew.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
# - no arguments are passed
if empty_argv || help_flag
require "help"
Homebrew::Help.help cmd, remaining_args: args.remaining, empty_argv: empty_argv
Homebrew::Help.help cmd, remaining_args: args.remaining, empty_argv:
# `Homebrew::Help.help` never returns, except for unknown commands.
end

Expand Down
6 changes: 3 additions & 3 deletions Library/Homebrew/build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def install
ENV.deps = formula_deps
ENV.run_time_deps = run_time_deps
ENV.setup_build_environment(
formula: formula,
formula:,
cc: args.cc,
build_bottle: args.build_bottle?,
bottle_arch: args.bottle_arch,
Expand All @@ -93,7 +93,7 @@ def install
end
else
ENV.setup_build_environment(
formula: formula,
formula:,
cc: args.cc,
build_bottle: args.build_bottle?,
bottle_arch: args.bottle_arch,
Expand Down Expand Up @@ -225,7 +225,7 @@ def fixopt(formula)

formula = args.named.to_formulae.first
options = Options.create(args.flags_only)
build = Build.new(formula, options, args: args)
build = Build.new(formula, options, args:)
build.install
rescue Exception => e # rubocop:disable Lint/RescueException
error_hash = JSON.parse e.to_json
Expand Down
16 changes: 8 additions & 8 deletions Library/Homebrew/cask/artifact/abstract_uninstall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ def uninstall_launchctl(*services, command: nil, **_)
plist_status = command.run(
"/bin/launchctl",
args: ["list", service],
sudo: sudo,
sudo:,
sudo_as_root: sudo,
print_stderr: false,
).stdout
if plist_status.start_with?("{")
command.run!(
"/bin/launchctl",
args: ["remove", service],
sudo: sudo,
sudo:,
sudo_as_root: sudo,
)
sleep 1
Expand All @@ -133,21 +133,21 @@ def uninstall_launchctl(*services, command: nil, **_)
paths.each { |elt| elt.prepend(Dir.home).freeze } unless sudo
paths = paths.map { |elt| Pathname(elt) }.select(&:exist?)
paths.each do |path|
command.run!("/bin/rm", args: ["-f", "--", path], sudo: sudo, sudo_as_root: sudo)
command.run!("/bin/rm", args: ["-f", "--", path], sudo:, sudo_as_root: sudo)
end
# undocumented and untested: pass a path to uninstall :launchctl
next unless Pathname(service).exist?

command.run!(
"/bin/launchctl",
args: ["unload", "-w", "--", service],
sudo: sudo,
sudo:,
sudo_as_root: sudo,
)
command.run!(
"/bin/rm",
args: ["-f", "--", service],
sudo: sudo,
sudo:,
sudo_as_root: sudo,
)
sleep 1
Expand Down Expand Up @@ -511,13 +511,13 @@ def recursive_rmdir(*directories, command: nil, **_)

# Directory counts as empty if it only contains a `.DS_Store`.
if children.include?(ds_store = resolved_path/".DS_Store")
Utils.gain_permissions_remove(ds_store, command: command)
Utils.gain_permissions_remove(ds_store, command:)
children.delete(ds_store)
end

next false unless recursive_rmdir(*children, command: command)
next false unless recursive_rmdir(*children, command:)

Utils.gain_permissions_rmdir(resolved_path, command: command)
Utils.gain_permissions_rmdir(resolved_path, command:)

true
end
Expand Down
3 changes: 0 additions & 3 deletions Library/Homebrew/cask/artifact/artifact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ def resolve_target(target)
end

sig { params(cask: Cask, source: T.any(String, Pathname), target: T.any(String, Pathname)).void }
def initialize(cask, source, target:)
super(cask, source, target: target)
end
end
end
end
2 changes: 1 addition & 1 deletion Library/Homebrew/cask/artifact/binary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Artifact
# @api private
class Binary < Symlinked
def link(command: nil, **options)
super(command: command, **options)
super(command:, **options)
return if source.executable?

if source.writable?
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cask/artifact/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def summarize
end

def to_h
{ path: path }.tap do |h|
{ path: }.tap do |h|
h[:args] = args unless is_a?(ManualInstaller)
end
end
Expand Down
24 changes: 12 additions & 12 deletions Library/Homebrew/cask/artifact/moved.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def move(adopt: false, force: false, verbose: false, predecessor: nil, reinstall
if target.parent.writable? && !force
target.rmdir
else
Utils.gain_permissions_remove(target, command: command)
Utils.gain_permissions_remove(target, command:)
end
end
else
Expand All @@ -55,7 +55,7 @@ def move(adopt: false, force: false, verbose: false, predecessor: nil, reinstall
same = command.run(
"/usr/bin/diff",
args: ["--recursive", "--brief", source, target],
verbose: verbose,
verbose:,
print_stdout: verbose,
).success?

Expand All @@ -76,22 +76,22 @@ def move(adopt: false, force: false, verbose: false, predecessor: nil, reinstall
raise CaskError, "#{message}." unless force

opoo "#{message}; overwriting."
delete(target, force: force, command: command, **options)
delete(target, force:, command:, **options)
end
end

ohai "Moving #{self.class.english_name} '#{source.basename}' to '#{target}'"

Utils.gain_permissions_mkpath(target.dirname, command: command) unless target.dirname.exist?
Utils.gain_permissions_mkpath(target.dirname, command:) unless target.dirname.exist?

if target.directory? && Quarantine.app_management_permissions_granted?(app: target, command: command)
if target.directory? && Quarantine.app_management_permissions_granted?(app: target, command:)
if target.writable?
source.children.each { |child| FileUtils.move(child, target/child.basename) }
else
command.run!("/bin/cp", args: ["-pR", *source.children, target],
sudo: true)
end
Quarantine.copy_xattrs(source, target, command: command)
Quarantine.copy_xattrs(source, target, command:)
source.rmtree
elsif target.dirname.writable?
FileUtils.move(source, target)
Expand All @@ -109,7 +109,7 @@ def move(adopt: false, force: false, verbose: false, predecessor: nil, reinstall
def post_move(command)
FileUtils.ln_sf target, source

add_altname_metadata(target, source.basename, command: command)
add_altname_metadata(target, source.basename, command:)
end

def matching_artifact?(cask)
Expand All @@ -129,7 +129,7 @@ def move_back(skip: false, force: false, command: nil, **options)
raise CaskError, "#{message}." unless force

opoo "#{message}; overwriting."
delete(source, force: force, command: command, **options)
delete(source, force:, command:, **options)
end

unless target.exist?
Expand All @@ -144,7 +144,7 @@ def move_back(skip: false, force: false, command: nil, **options)
# We need to preserve extended attributes between copies.
command.run!("/bin/cp", args: ["-pR", target, source], sudo: !source.parent.writable?)

delete(target, force: force, command: command, **options)
delete(target, force:, command:, **options)
end

def delete(target, force: false, successor: nil, command: nil, **_)
Expand All @@ -154,21 +154,21 @@ def delete(target, force: false, successor: nil, command: nil, **_)
return unless Utils.path_occupied?(target)

if target.directory? && matching_artifact?(successor) && Quarantine.app_management_permissions_granted?(
app: target, command: command,
app: target, command:,
)
# If an app folder is deleted, macOS considers the app uninstalled and removes some data.
# Remove only the contents to handle this case.
target.children.each do |child|
if target.writable? && !force
child.rmtree
else
Utils.gain_permissions_remove(child, command: command)
Utils.gain_permissions_remove(child, command:)
end
end
elsif target.parent.writable? && !force
target.rmtree
else
Utils.gain_permissions_remove(target, command: command)
Utils.gain_permissions_remove(target, command:)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/cask/artifact/pkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ def run_installer(command: nil, verbose: false, **_options)
"/usr/sbin/installer",
sudo: true,
sudo_as_root: true,
args: args,
args:,
print_stdout: true,
env: env,
env:,
)
end
end
Expand Down
10 changes: 5 additions & 5 deletions Library/Homebrew/cask/artifact/symlinked.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,30 +57,30 @@ def link(force: false, command: nil, **_options)
if force && target.symlink? &&
(target.realpath == source.realpath || target.realpath.to_s.start_with?("#{cask.caskroom_path}/"))
opoo "#{message}; overwriting."
Utils.gain_permissions_remove(target, command: command)
Utils.gain_permissions_remove(target, command:)
else
raise CaskError, "#{message}."
end
end

ohai "Linking #{self.class.english_name} '#{source.basename}' to '#{target}'"
create_filesystem_link(command: command)
create_filesystem_link(command:)
end

def unlink(command: nil, **)
return unless target.symlink?

ohai "Unlinking #{self.class.english_name} '#{target}'"
Utils.gain_permissions_remove(target, command: command)
Utils.gain_permissions_remove(target, command:)
end

def create_filesystem_link(command: nil)
Utils.gain_permissions_mkpath(target.dirname, command: command)
Utils.gain_permissions_mkpath(target.dirname, command:)

command.run! "/bin/ln", args: ["-h", "-f", "-s", "--", source, target],
sudo: !target.dirname.writable?

add_altname_metadata(source, target.basename, command: command)
add_altname_metadata(source, target.basename, command:)
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions Library/Homebrew/cask/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def initialize(
download = online || signing if download.nil?

@cask = cask
@download = Download.new(cask, quarantine: quarantine) if download
@download = Download.new(cask, quarantine:) if download
@online = online
@strict = strict
@signing = signing
Expand Down Expand Up @@ -95,7 +95,7 @@ def add_error(message, location: nil, strict_only: false)
# Only raise non-critical audits if the user specified `--strict`.
return if strict_only && !@strict

errors << ({ message: message, location: location, corrected: false })
errors << ({ message:, location:, corrected: false })
end

def result
Expand Down Expand Up @@ -663,7 +663,7 @@ def audit_github_prerelease_version

tag = SharedAudits.github_tag_from_url(cask.url)
tag ||= cask.version
error = SharedAudits.github_release(user, repo, tag, cask: cask)
error = SharedAudits.github_release(user, repo, tag, cask:)
add_error error, location: cask.url.location if error
end

Expand All @@ -678,7 +678,7 @@ def audit_gitlab_prerelease_version

tag = SharedAudits.gitlab_tag_from_url(cask.url)
tag ||= cask.version
error = SharedAudits.gitlab_release(user, repo, tag, cask: cask)
error = SharedAudits.gitlab_release(user, repo, tag, cask:)
add_error error, location: cask.url.location if error
end

Expand Down Expand Up @@ -783,7 +783,7 @@ def audit_homepage_https_availability

validate_url_for_https_availability(
homepage, SharedAudits::URL_TYPE_HOMEPAGE,
user_agents: user_agents,
user_agents:,
check_content: true,
strict: strict?
)
Expand Down Expand Up @@ -843,7 +843,7 @@ def validate_url_for_https_availability(url_to_check, url_type, location: nil, *
add_error problem, location: location unless exception
elsif exception
add_error "#{url_to_check} is in the secure connection audit skiplist but does not need to be skipped",
location: location
location:
end
end

Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cask/auditor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def output_summary?(audit = nil)

def audit_languages(languages)
original_config = cask.config
localized_config = original_config.merge(Config.new(explicit: { languages: languages }))
localized_config = original_config.merge(Config.new(explicit: { languages: }))
cask.config = localized_config

audit_cask_instance(cask)
Expand Down

0 comments on commit 28e5cde

Please sign in to comment.