mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
tap: no-op on invalid audit exception files
Also shift logic to directory-based organization instead of a single file with all lists
This commit is contained in:
parent
e1f463ff26
commit
f33a4bff37
@ -526,8 +526,6 @@ class Tap
|
|||||||
|
|
||||||
# Hash with tap formula renames
|
# Hash with tap formula renames
|
||||||
def formula_renames
|
def formula_renames
|
||||||
require "json"
|
|
||||||
|
|
||||||
@formula_renames ||= if (rename_file = path/"formula_renames.json").file?
|
@formula_renames ||= if (rename_file = path/"formula_renames.json").file?
|
||||||
JSON.parse(rename_file.read)
|
JSON.parse(rename_file.read)
|
||||||
else
|
else
|
||||||
@ -537,8 +535,6 @@ class Tap
|
|||||||
|
|
||||||
# Hash with tap migrations
|
# Hash with tap migrations
|
||||||
def tap_migrations
|
def tap_migrations
|
||||||
require "json"
|
|
||||||
|
|
||||||
@tap_migrations ||= if (migration_file = path/"tap_migrations.json").file?
|
@tap_migrations ||= if (migration_file = path/"tap_migrations.json").file?
|
||||||
JSON.parse(migration_file.read)
|
JSON.parse(migration_file.read)
|
||||||
else
|
else
|
||||||
@ -548,13 +544,22 @@ class Tap
|
|||||||
|
|
||||||
# Hash with audit exceptions
|
# Hash with audit exceptions
|
||||||
def audit_exceptions
|
def audit_exceptions
|
||||||
require "json"
|
@audit_exceptions = {}
|
||||||
|
|
||||||
@audit_exceptions ||= if (audit_exceptions_file = path/"audit_exceptions.json").file?
|
Dir[path/"audit_exceptions/*"].each do |exception_file|
|
||||||
JSON.parse(audit_exceptions_file.read)
|
list_name = File.basename(exception_file).chomp(".json").to_sym
|
||||||
else
|
list_contents = begin
|
||||||
{}
|
JSON.parse Pathname.new(exception_file).read
|
||||||
|
rescue JSON::ParserError
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
next if list_contents.nil?
|
||||||
|
|
||||||
|
@audit_exceptions[list_name] = list_contents
|
||||||
|
end
|
||||||
|
|
||||||
|
@audit_exceptions
|
||||||
end
|
end
|
||||||
|
|
||||||
def ==(other)
|
def ==(other)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user