Skip to content

Commit

Permalink
Merge pull request #18682 from Homebrew/dependabot/bundler/Library/Ho…
Browse files Browse the repository at this point in the history
…mebrew/rubocop-1.68.0

build(deps-dev): bump rubocop from 1.67.0 to 1.68.0 in /Library/Homebrew
  • Loading branch information
MikeMcQuaid authored Nov 5, 2024
2 parents e1c8b33 + 24d3b46 commit 591057e
Show file tree
Hide file tree
Showing 13 changed files with 916 additions and 449 deletions.
5 changes: 5 additions & 0 deletions Library/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,11 @@ Style/OptionalBooleanParameter:
- respond_to?
- respond_to_missing?

# Broken in RuboCop 1.68.0 so tries to fix line continuations in inline patch blocks:
# https://github.com/Homebrew/brew/actions/runs/11653110391/job/32460881827?pr=18682
Style/RedundantLineContinuation:
Enabled: false

# Rescuing `StandardError` is an understood default.
Style/RescueStandardError:
EnforcedStyle: implicit
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ GEM
rspec-support (3.13.1)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.67.0)
rubocop (1.68.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/cask/cask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ def uninstall_flight_blocks?
sig { returns(T.nilable(Time)) }
def install_time
# <caskroom_path>/.metadata/<version>/<timestamp>/Casks/<token>.{rb,json} -> <timestamp>
time = installed_caskfile&.dirname&.dirname&.basename&.to_s
Time.strptime(time, Metadata::TIMESTAMP_FORMAT) if time
caskfile = installed_caskfile
Time.strptime(caskfile.dirname.dirname.basename.to_s, Metadata::TIMESTAMP_FORMAT) if caskfile
end

sig { returns(T.nilable(Pathname)) }
Expand Down
6 changes: 3 additions & 3 deletions Library/Homebrew/cask/quarantine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,11 @@ def self.app_management_permissions_granted?(app:, command:)
# including both file ownership and whether system permissions are granted.
# Here we just want to check whether sudo would be needed.
looks_writable_without_sudo = if app.owned?
(app.lstat.mode & 0200) != 0
app.lstat.mode.anybits?(0200)
elsif app.grpowned?
(app.lstat.mode & 0020) != 0
app.lstat.mode.anybits?(0020)
else
(app.lstat.mode & 0002) != 0
app.lstat.mode.anybits?(0002)
end

if looks_writable_without_sudo
Expand Down
5 changes: 3 additions & 2 deletions Library/Homebrew/cleanup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,11 @@ def stale_formula?(pathname, scrub)

resource_name = basename_str[/\A.*?--(.*?)--?(?:#{Regexp.escape(version.to_s)})/, 1]

stable = formula.stable
if resource_name == "patch"
patch_hashes = formula.stable&.patches&.select(&:external?)&.map(&:resource)&.map(&:version)
patch_hashes = stable&.patches&.filter_map { _1.resource.version if _1.external? }
return true unless patch_hashes&.include?(Checksum.new(version.to_s))
elsif resource_name && (resource_version = formula.stable&.resources&.dig(resource_name)&.version)
elsif resource_name && stable && (resource_version = stable.resources[resource_name]&.version)
return true if resource_version != version
elsif (formula.latest_version_installed? && formula.pkg_version.to_s != version) ||
formula.pkg_version.to_s > version
Expand Down
6 changes: 5 additions & 1 deletion Library/Homebrew/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,11 @@ def oldnames
# @api internal
sig { returns(T::Array[String]) }
def aliases
@aliases ||= tap&.alias_reverse_table&.dig(full_name)&.map { _1.split("/").last } || []
@aliases ||= if (tap = self.tap)
tap.alias_reverse_table.fetch(full_name, []).map { _1.split("/").last }
else
[]
end
end

# The {Resource}s for the currently active {SoftwareSpec}.
Expand Down
10 changes: 6 additions & 4 deletions Library/Homebrew/formulary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,12 @@ def post_install_defined?

@caveats_string = json_formula["caveats"]
def caveats
self.class.instance_variable_get(:@caveats_string)
&.gsub(HOMEBREW_PREFIX_PLACEHOLDER, HOMEBREW_PREFIX)
&.gsub(HOMEBREW_CELLAR_PLACEHOLDER, HOMEBREW_CELLAR)
&.gsub(HOMEBREW_HOME_PLACEHOLDER, Dir.home)
caveats_string = self.class.instance_variable_get(:@caveats_string)
return unless caveats_string

caveats_string.gsub(HOMEBREW_PREFIX_PLACEHOLDER, HOMEBREW_PREFIX)
.gsub(HOMEBREW_CELLAR_PLACEHOLDER, HOMEBREW_CELLAR)
.gsub(HOMEBREW_HOME_PLACEHOLDER, Dir.home)
end

@tap_git_head_string = if Homebrew::API.internal_json_v3?
Expand Down
11 changes: 7 additions & 4 deletions Library/Homebrew/livecheck/livecheck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,13 @@ def self.run_checks(
extract_plist = true if formulae_and_casks_total == 1

formulae_checked = formulae_and_casks_to_check.map.with_index do |formula_or_cask, i|
formula = formula_or_cask if formula_or_cask.is_a?(Formula)
cask = formula_or_cask if formula_or_cask.is_a?(Cask::Cask)
case formula_or_cask
when Formula
formula = formula_or_cask
formula.head&.downloader&.quiet!
when Cask::Cask
cask = formula_or_cask
end

use_full_name = full_name || ambiguous_names.include?(formula_or_cask)
name = package_or_resource_name(formula_or_cask, full_name: use_full_name)
Expand Down Expand Up @@ -238,8 +243,6 @@ def self.run_checks(
next
end

formula&.head&.downloader&.quiet!

# Use the `stable` version for comparison except for installed
# head-only formulae. A formula with `stable` and `head` that's
# installed using `--head` will still use the `stable` version for
Expand Down
Loading

0 comments on commit 591057e

Please sign in to comment.