Skip to content

Commit

Permalink
feat: add audit for wayback machine URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
SMillerDev committed Jan 13, 2024
1 parent 302e83e commit b308bf5
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Library/Homebrew/formula_auditor.rb
Expand Up @@ -590,6 +590,28 @@ def audit_bottle_spec
new_formula_problem "New formulae in homebrew/core should not have a `bottle do` block"
end

def audit_wayback_url
return unless @core_tap
return if formula.deprecated? || formula.disabled?

regex = %r{^https?://web\.archive\.org}

Check warning on line 597 in Library/Homebrew/formula_auditor.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/formula_auditor.rb#L597

Added line #L597 was not covered by tests
if regex.match?(formula.stable.url)
problem "Formula with a Wayback URL should be deprecated with `:repo_removed`"
return

Check warning on line 600 in Library/Homebrew/formula_auditor.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/formula_auditor.rb#L600

Added line #L600 was not covered by tests
end

if regex.match?(formula.homepage)
problem "Formula with a Wayback homepage should find an alternative homepage"
return

Check warning on line 605 in Library/Homebrew/formula_auditor.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/formula_auditor.rb#L605

Added line #L605 was not covered by tests
end

return unless formula.head

return unless regex.match?(formula.head.url)

problem "Formula with a Wayback `HEAD` URL should not have a `HEAD` definition"

Check warning on line 612 in Library/Homebrew/formula_auditor.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/formula_auditor.rb#L612

Added line #L612 was not covered by tests
end

def audit_github_repository_archived
return if formula.deprecated? || formula.disabled?

Expand Down

0 comments on commit b308bf5

Please sign in to comment.