diff --git a/Library/Homebrew/cask/artifact/symlinked.rb b/Library/Homebrew/cask/artifact/symlinked.rb index a5d8d0ab9b..3cef93a179 100644 --- a/Library/Homebrew/cask/artifact/symlinked.rb +++ b/Library/Homebrew/cask/artifact/symlinked.rb @@ -56,7 +56,7 @@ module Cask message = "It seems there is already #{self.class.english_article} " \ "#{self.class.english_name} at '#{target}'" - if force && target.symlink? && \ + if force && target.symlink? && (target.realpath == source.realpath || target.realpath.to_s.start_with?("#{cask.caskroom_path}/")) opoo "#{message}; overwriting." target.delete diff --git a/Library/Homebrew/dev-cmd/bump.rb b/Library/Homebrew/dev-cmd/bump.rb index e12702f415..50916f9a2f 100644 --- a/Library/Homebrew/dev-cmd/bump.rb +++ b/Library/Homebrew/dev-cmd/bump.rb @@ -72,7 +72,7 @@ module Homebrew ambiguous_casks = [] if !args.formula? && !args.cask? - ambiguous_casks = formulae_and_casks \ + ambiguous_casks = formulae_and_casks .group_by { |item| Livecheck.package_or_resource_name(item, full_name: true) } .values .select { |items| items.length > 1 } diff --git a/Library/Homebrew/livecheck/livecheck.rb b/Library/Homebrew/livecheck/livecheck.rb index a2a015c8aa..166beee14f 100644 --- a/Library/Homebrew/livecheck/livecheck.rb +++ b/Library/Homebrew/livecheck/livecheck.rb @@ -182,7 +182,7 @@ module Homebrew ambiguous_casks = [] if handle_name_conflict - ambiguous_casks = formulae_and_casks_to_check \ + ambiguous_casks = formulae_and_casks_to_check .group_by { |item| package_or_resource_name(item, full_name: true) } .values .select { |items| items.length > 1 } diff --git a/Library/Homebrew/migrator.rb b/Library/Homebrew/migrator.rb index ee60d5e242..00335b712e 100644 --- a/Library/Homebrew/migrator.rb +++ b/Library/Homebrew/migrator.rb @@ -360,14 +360,14 @@ class Migrator # Remove `opt/oldname` link if it belongs to newname. def unlink_oldname_opt - return unless old_opt_record + return if old_opt_record.blank? + return unless old_opt_record.symlink? + return unless old_opt_record.exist? + return unless new_linked_keg_record.exist? + return if new_linked_keg_record.realpath != old_opt_record.realpath - if old_opt_record.symlink? && old_opt_record.exist? \ - && new_linked_keg_record.exist? \ - && new_linked_keg_record.realpath == old_opt_record.realpath - old_opt_record.unlink - old_opt_record.parent.rmdir_if_possible - end + old_opt_record.unlink + old_opt_record.parent.rmdir_if_possible end # Remove `Cellar/oldname` if it exists. diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 5d15185e85..d1c13f049c 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -120,7 +120,7 @@ class SoftwareSpec end def bottled?(tag = nil) - bottle_tag?(tag) && \ + bottle_tag?(tag) && (tag.present? || bottle_specification.compatible_locations? || owner.force_bottle) end diff --git a/Library/Homebrew/test/system_command_spec.rb b/Library/Homebrew/test/system_command_spec.rb index 437aea0b2c..a142576ad7 100644 --- a/Library/Homebrew/test/system_command_spec.rb +++ b/Library/Homebrew/test/system_command_spec.rb @@ -236,7 +236,7 @@ describe SystemCommand do "-c", 'printf "\r%s" "################### 27.6%" 1>&2', ] - end.to output( \ + end.to output( "\r################### 27.6%", ).to_stderr end diff --git a/Library/Homebrew/test/utils/pypi_spec.rb b/Library/Homebrew/test/utils/pypi_spec.rb index 3b857e758c..c0ba3ed88e 100644 --- a/Library/Homebrew/test/utils/pypi_spec.rb +++ b/Library/Homebrew/test/utils/pypi_spec.rb @@ -155,7 +155,7 @@ describe PyPI do describe "<=>" do it "returns -1" do - expect(package <=> other_package).to eq((-1)) + expect(package <=> other_package).to eq(-1) end it "returns 0" do