diff --git a/Library/Homebrew/formula_auditor.rb b/Library/Homebrew/formula_auditor.rb index 66b6fc60f8c31f..8b55cecb41254e 100644 --- a/Library/Homebrew/formula_auditor.rb +++ b/Library/Homebrew/formula_auditor.rb @@ -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?