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 5e6f90f
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"

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

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/formula_auditor.rb#L610-L611

Added lines #L610 - L611 were not covered by tests

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"

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

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/formula_auditor.rb#L623

Added line #L623 was not covered by tests
end

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

Expand Down

0 comments on commit 5e6f90f

Please sign in to comment.