Manually resolve Style/SafeNavigationChainLength violations
This commit is contained in:
parent
ffb15ffcf5
commit
521c463e36
@ -173,8 +173,8 @@ module Cask
|
||||
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
|
||||
caskfile ? Time.strptime(caskfile.dirname.dirname.basename.to_s, Metadata::TIMESTAMP_FORMAT) : nil
|
||||
end
|
||||
|
||||
sig { returns(T.nilable(Pathname)) }
|
||||
|
||||
@ -152,10 +152,11 @@ module Homebrew
|
||||
|
||||
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
|
||||
|
||||
@ -593,7 +593,11 @@ class Formula
|
||||
# @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}.
|
||||
|
||||
@ -418,10 +418,12 @@ module Formulary
|
||||
|
||||
@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?
|
||||
|
||||
@ -195,8 +195,13 @@ module Homebrew
|
||||
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)
|
||||
@ -238,8 +243,6 @@ module Homebrew
|
||||
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
|
||||
|
||||
@ -524,7 +524,7 @@ class Tap
|
||||
Commands.rebuild_commands_completion_list
|
||||
link_completions_and_manpages
|
||||
|
||||
formatted_contents = contents.presence&.to_sentence&.dup&.prepend(" ")
|
||||
formatted_contents = contents.presence&.to_sentence&.prepend(" ")
|
||||
$stderr.puts "Tapped#{formatted_contents} (#{path.abv})." unless quiet
|
||||
|
||||
require "description_cache_store"
|
||||
@ -622,7 +622,7 @@ class Tap
|
||||
$stderr.puts "Untapping #{name}..."
|
||||
|
||||
abv = path.abv
|
||||
formatted_contents = contents.presence&.to_sentence&.dup&.prepend(" ")
|
||||
formatted_contents = contents.presence&.to_sentence&.prepend(" ")
|
||||
|
||||
require "description_cache_store"
|
||||
CacheStoreDatabase.use(:descriptions) do |db|
|
||||
|
||||
@ -154,7 +154,9 @@ module SPDX
|
||||
if with_parts.length > 1
|
||||
{ with_parts.first => { with: with_parts.second } }
|
||||
else
|
||||
license_sym = result[/^#{LICENSEREF_PREFIX}(.+)/o, 1]&.downcase&.tr("-", "_")&.to_sym
|
||||
return result unless result.start_with?(LICENSEREF_PREFIX)
|
||||
|
||||
license_sym = result.delete_prefix(LICENSEREF_PREFIX).downcase.tr("-", "_").to_sym
|
||||
ALLOWED_LICENSE_SYMBOLS.include?(license_sym) ? license_sym : result
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user