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 a190780
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Library/Homebrew/formula_auditor.rb
Expand Up @@ -590,6 +590,26 @@ 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}
if regex.match?(formula.stable.url)
problem "Formula with a Wayback URL should be deprecated with `:repo_removed`"
return
end

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

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

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

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

Expand Down

0 comments on commit a190780

Please sign in to comment.