Skip to content

Commit

Permalink
Merge pull request #18541 from Homebrew/audit-autobump
Browse files Browse the repository at this point in the history
tap_auditor: check formulae names in autobump.txt
  • Loading branch information
cho-m authored Oct 11, 2024
2 parents 587949b + 3d95905 commit 3ba4b8d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Library/Homebrew/tap_auditor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def initialize(tap, strict:)
@tap_audit_exceptions = tap.audit_exceptions
@tap_style_exceptions = tap.style_exceptions
@tap_pypi_formula_mappings = tap.pypi_formula_mappings
@tap_autobump = tap.autobump
@problems = []

@cask_tokens = tap.cask_tokens.map do |cask_token|
Expand Down Expand Up @@ -52,6 +53,7 @@ def audit_tap_formula_lists
check_formula_list_directory "audit_exceptions", @tap_audit_exceptions
check_formula_list_directory "style_exceptions", @tap_style_exceptions
check_formula_list "pypi_formula_mappings", @tap_pypi_formula_mappings
check_formula_list ".github/autobump.txt", @tap_autobump
end

sig { void }
Expand All @@ -71,9 +73,10 @@ def problem(message)

sig { params(list_file: String, list: T.untyped).void }
def check_formula_list(list_file, list)
list_file += ".json" if File.extname(list_file).empty?
unless [Hash, Array].include? list.class
problem <<~EOS
#{list_file}.json should contain a JSON array
#{list_file} should contain a JSON array
of formula names or a JSON object mapping formula names to values
EOS
return
Expand All @@ -89,7 +92,7 @@ def check_formula_list(list_file, list)
return if invalid_formulae_casks.empty?

problem <<~EOS
#{list_file}.json references
#{list_file} references
formulae or casks that are not found in the #{@name} tap.
Invalid formulae or casks: #{invalid_formulae_casks.join(", ")}
EOS
Expand Down

0 comments on commit 3ba4b8d

Please sign in to comment.