Skip to content

Commit

Permalink
tap_auditor: check formulae names in autobump.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
cho-m committed Oct 9, 2024
1 parent 8273105 commit 3d95905
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

Check warning on line 18 in Library/Homebrew/tap_auditor.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/tap_auditor.rb#L18

Added line #L18 was not covered by tests
@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

Check warning on line 56 in Library/Homebrew/tap_auditor.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/tap_auditor.rb#L56

Added line #L56 was not covered by tests
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 3d95905

Please sign in to comment.