aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/dev-cmd/audit.rb32
-rw-r--r--Library/Homebrew/locale.rb6
-rw-r--r--Library/Homebrew/test/locale_spec.rb4
3 files changed, 10 insertions, 32 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb
index a7d498c0d..49e7969af 100644
--- a/Library/Homebrew/dev-cmd/audit.rb
+++ b/Library/Homebrew/dev-cmd/audit.rb
@@ -396,7 +396,6 @@ class FormulaAuditor
return if formula.tap.nil? || !formula.tap.official?
name = formula.name
- full_name = formula.full_name
if Homebrew::MissingFormula.blacklisted_reason(name)
problem "'#{name}' is blacklisted."
@@ -412,35 +411,10 @@ class FormulaAuditor
return
end
- if !formula.core_formula? && Formula.core_names.include?(name)
- problem "Formula name conflicts with existing core formula."
- return
- end
-
- @@local_official_taps_name_map ||= Tap.select(&:official?).flat_map(&:formula_names)
- .each_with_object({}) do |tap_formula_full_name, name_map|
- next if tap_formula_full_name.start_with?("homebrew/science/")
- tap_formula_name = tap_formula_full_name.split("/").last
- name_map[tap_formula_name] ||= []
- name_map[tap_formula_name] << tap_formula_full_name
- name_map
- end
-
- same_name_tap_formulae = @@local_official_taps_name_map[name] || []
-
- if @online
- Homebrew.search_taps(name, silent: true).each do |tap_formula_full_name|
- next if tap_formula_full_name.start_with?("homebrew/science/")
- tap_formula_name = tap_formula_full_name.split("/").last
- next if tap_formula_name != name
- same_name_tap_formulae << tap_formula_full_name
- end
- end
-
- same_name_tap_formulae.delete(full_name)
+ return if formula.core_formula?
+ return unless Formula.core_names.include?(name)
- return if same_name_tap_formulae.empty?
- problem "Formula name conflicts with #{same_name_tap_formulae.join ", "}"
+ problem "Formula name conflicts with existing core formula."
end
def audit_deps
diff --git a/Library/Homebrew/locale.rb b/Library/Homebrew/locale.rb
index d918e2a2a..c430d11b6 100644
--- a/Library/Homebrew/locale.rb
+++ b/Library/Homebrew/locale.rb
@@ -2,9 +2,9 @@ class Locale
class ParserError < StandardError
end
- LANGUAGE_REGEX = /(?:[a-z]{2,3})/ # ISO 639-1 or ISO 639-2
- REGION_REGEX = /(?:[A-Z]{2})/ # ISO 3166-1
- SCRIPT_REGEX = /(?:[A-Z][a-z]{3})/ # ISO 15924
+ LANGUAGE_REGEX = /(?:[a-z]{2,3})/ # ISO 639-1 or ISO 639-2
+ REGION_REGEX = /(?:[A-Z]{2}|\d{3})/ # ISO 3166-1 or UN M.49
+ SCRIPT_REGEX = /(?:[A-Z][a-z]{3})/ # ISO 15924
LOCALE_REGEX = /\A((?:#{LANGUAGE_REGEX}|#{REGION_REGEX}|#{SCRIPT_REGEX})(?:\-|$)){1,3}\Z/
diff --git a/Library/Homebrew/test/locale_spec.rb b/Library/Homebrew/test/locale_spec.rb
index 9e4d09e83..9c684f0e7 100644
--- a/Library/Homebrew/test/locale_spec.rb
+++ b/Library/Homebrew/test/locale_spec.rb
@@ -9,6 +9,10 @@ describe Locale do
expect(described_class.parse("zh-CN-Hans")).to eql(described_class.new("zh", "CN", "Hans"))
end
+ it "correctly parses a string with a UN M.49 region code" do
+ expect(described_class.parse("es-419")).to eql(described_class.new("es", "419", nil))
+ end
+
context "raises a ParserError when given" do
it "an empty string" do
expect { described_class.parse("") }.to raise_error(Locale::ParserError)