brew style --fix

This commit is contained in:
Mike McQuaid 2021-11-02 11:16:10 +00:00
parent a2cd969ddc
commit d43555dd75
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829
9 changed files with 10 additions and 10 deletions

View File

@ -26,7 +26,7 @@ module Cask
return to_enum unless block return to_enum unless block
Tap.flat_map(&:cask_files).each do |f| Tap.flat_map(&:cask_files).each do |f|
block.call CaskLoader::FromTapPathLoader.new(f).load(config: nil) yield CaskLoader::FromTapPathLoader.new(f).load(config: nil)
rescue CaskUnreadableError => e rescue CaskUnreadableError => e
opoo e.message opoo e.message
end end

View File

@ -1674,9 +1674,9 @@ class Formula
end end
# @private # @private
def self.each(&block) def self.each(&_block)
files.each do |file| files.each do |file|
block.call Formulary.factory(file) yield Formulary.factory(file)
rescue FormulaUnavailableError, FormulaUnreadableError => e rescue FormulaUnavailableError, FormulaUnreadableError => e
# Don't let one broken formula break commands. But do complain. # Don't let one broken formula break commands. But do complain.
onoe "Failed to import: #{file}" onoe "Failed to import: #{file}"

View File

@ -50,7 +50,7 @@ module Homebrew
yaml = YAML.safe_load(content) yaml = YAML.safe_load(content)
return [] if yaml.blank? return [] if yaml.blank?
return Strategy.handle_block_return(block.call(yaml)) if block return Strategy.handle_block_return(yield(yaml)) if block
version = yaml["version"] version = yaml["version"]
version.present? ? [version] : [] version.present? ? [version] : []

View File

@ -68,7 +68,7 @@ module Homebrew
).returns(T::Array[String]) ).returns(T::Array[String])
} }
def self.versions_from_items(items, &block) def self.versions_from_items(items, &block)
return Strategy.handle_block_return(block.call(items)) if block return Strategy.handle_block_return(yield(items)) if block
items.map do |_key, item| items.map do |_key, item|
item.bundle_version.nice_version item.bundle_version.nice_version

View File

@ -93,7 +93,7 @@ module Homebrew
).returns(T::Array[String]) ).returns(T::Array[String])
} }
def self.versions_from_tags(tags, regex = nil, &block) def self.versions_from_tags(tags, regex = nil, &block)
return Strategy.handle_block_return(block.call(tags, regex || DEFAULT_REGEX)) if block return Strategy.handle_block_return(yield(tags, regex || DEFAULT_REGEX)) if block
tags_only_debian = tags.all? { |tag| tag.start_with?("debian/") } tags_only_debian = tags.all? { |tag| tag.start_with?("debian/") }

View File

@ -53,7 +53,7 @@ module Homebrew
).returns(T::Array[String]) ).returns(T::Array[String])
} }
def self.versions_from_headers(headers, regex = nil, &block) def self.versions_from_headers(headers, regex = nil, &block)
return Strategy.handle_block_return(block.call(headers, regex)) if block return Strategy.handle_block_return(yield(headers, regex)) if block
DEFAULT_HEADERS_TO_CHECK.map do |header_name| DEFAULT_HEADERS_TO_CHECK.map do |header_name|
header_value = headers[header_name] header_value = headers[header_name]

View File

@ -57,7 +57,7 @@ module Homebrew
).returns(T::Array[String]) ).returns(T::Array[String])
} }
def self.versions_from_content(content, regex, &block) def self.versions_from_content(content, regex, &block)
return Strategy.handle_block_return(block.call(content, regex)) if block return Strategy.handle_block_return(yield(content, regex)) if block
return [] if regex.blank? return [] if regex.blank?
content.scan(regex).map do |match| content.scan(regex).map do |match|

View File

@ -157,7 +157,7 @@ module Homebrew
item = item_from_content(content) item = item_from_content(content)
return [] if item.blank? return [] if item.blank?
return Strategy.handle_block_return(block.call(item)) if block return Strategy.handle_block_return(yield(item)) if block
version = item.bundle_version&.nice_version version = item.bundle_version&.nice_version
version.present? ? [version] : [] version.present? ? [version] : []

View File

@ -659,7 +659,7 @@ class Tap
TAP_DIRECTORY.subdirs.each do |user| TAP_DIRECTORY.subdirs.each do |user|
user.subdirs.each do |repo| user.subdirs.each do |repo|
block.call fetch(user.basename.to_s, repo.basename.to_s) yield fetch(user.basename.to_s, repo.basename.to_s)
end end
end end
end end