Merge pull request #11542 from samford/exclude-version-audit-on-ci

Exclude version audit on CI
This commit is contained in:
Sam Ford 2021-06-16 14:13:11 -04:00 committed by GitHub
commit aa7d3280d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 13 deletions

View File

@ -78,7 +78,7 @@ jobs:
run: brew style --display-cop-names homebrew/core
- name: Run brew audit --skip-style on all taps
run: brew audit --skip-style --display-failures-only
run: brew audit --skip-style --except=version --display-failures-only
- name: Set up all Homebrew taps
run: |
@ -112,7 +112,7 @@ jobs:
HOMEBREW_SIMULATE_MACOS_ON_LINUX: 1
- name: Run brew audit --skip-style on homebrew-core
run: brew audit --skip-style --tap=homebrew/core
run: brew audit --skip-style --except=version --tap=homebrew/core
env:
HOMEBREW_SIMULATE_MACOS_ON_LINUX: 1

View File

@ -500,7 +500,10 @@ module Homebrew
spec_name = name.downcase.to_sym
next unless (spec = formula.send(spec_name))
ra = ResourceAuditor.new(spec, spec_name, online: @online, strict: @strict).audit
ra = ResourceAuditor.new(
spec, spec_name,
online: @online, strict: @strict, only: @only, except: @except
).audit
ra.problems.each do |message|
problem "#{name}: #{message}"
end
@ -508,7 +511,10 @@ module Homebrew
spec.resources.each_value do |resource|
problem "Resource name should be different from the formula name" if resource.name == formula.name
ra = ResourceAuditor.new(resource, spec_name, online: @online, strict: @strict).audit
ra = ResourceAuditor.new(
resource, spec_name,
online: @online, strict: @strict, only: @only, except: @except
).audit
ra.problems.each do |message|
problem "#{name} resource #{resource.name.inspect}: #{message}"
end
@ -746,11 +752,9 @@ module Homebrew
methods.map(&:to_s).grep(/^audit_/).each do |audit_method_name|
name = audit_method_name.delete_prefix("audit_")
if only_audits
next unless only_audits.include?(name)
elsif except_audits
next if except_audits.include?(name)
end
next if only_audits&.exclude?(name)
next if except_audits&.include?(name)
send(audit_method_name)
end
end

View File

@ -20,14 +20,23 @@ module Homebrew
@spec_name = spec_name
@online = options[:online]
@strict = options[:strict]
@only = options[:only]
@except = options[:except]
@problems = []
end
def audit
audit_version
audit_download_strategy
audit_checksum
audit_urls
only_audits = @only
except_audits = @except
methods.map(&:to_s).grep(/^audit_/).each do |audit_method_name|
name = audit_method_name.delete_prefix("audit_")
next if only_audits&.exclude?(name)
next if except_audits&.include?(name)
send(audit_method_name)
end
self
end