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 Feb 29, 2024
1 parent 154a217 commit b48e0ce
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Library/Homebrew/formula_auditor.rb
Expand Up @@ -622,6 +622,26 @@ 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 @core_tap
return if formula.deprecated? || formula.disabled?

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

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

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/formula_auditor.rb#L629

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

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

return unless formula.head

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

problem "Formula with a Wayback `head` should not have a `head` definition"

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

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/formula_auditor.rb#L642

Added line #L642 was not covered by tests
end

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

Expand Down

0 comments on commit b48e0ce

Please sign in to comment.