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 Apr 25, 2024
1 parent 0612657 commit 50d5333
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Library/Homebrew/formula_auditor.rb
Expand Up @@ -602,6 +602,28 @@ def audit_eol
problem "Product is EOL since #{metadata["eol"]}, #{see_url}" if Date.parse(metadata["eol"]) <= Date.today
end

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

regex = %r{^https?://web\.archive\.org}
problem_prefix = "Formula with a Internet Archive Wayback Machine"
if regex.match?(formula.stable.url)
problem "#{problem_prefix} `url` should be deprecated with `:repo_removed`"
end

if regex.match?(formula.homepage)
problem "#{problem_prefix} `homepage` should find an alternative `homepage` or be deprecated."
end

return unless formula.head

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

problem "Remove Internet Archive Wayback Machine `head` URL"
end

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

Expand Down

0 comments on commit 50d5333

Please sign in to comment.