Skip to content

Commit

Permalink
Merge pull request #16476 from SMillerDev/feat/audit/wayback_deprecation
Browse files Browse the repository at this point in the history
feat: add audit for wayback machine URLs
  • Loading branch information
MikeMcQuaid committed Apr 25, 2024
2 parents a47c45d + 5e6f90f commit dfab16a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Library/Homebrew/formula_auditor.rb
Expand Up @@ -602,6 +602,27 @@ 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"

problem "#{problem_prefix} `url` should be deprecated with `:repo_removed`" if regex.match?(formula.stable.url)

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 dfab16a

Please sign in to comment.