diff options
| author | Mike McQuaid | 2016-08-18 12:55:19 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2016-08-18 15:04:51 +0100 |
| commit | 41f6334b5b11e8cd2cc67750aee47d4acdb4ee52 (patch) | |
| tree | b54cb4a97db1bc67f5704c726ebd4622dd8f4f23 /Library/Homebrew/cmd | |
| parent | eea0da362bd01abc74e66e64909b0be11c01322e (diff) | |
| download | brew-41f6334b5b11e8cd2cc67750aee47d4acdb4ee52.tar.bz2 | |
audit: make audit_revision more generic.
This will allow it to be used for checking other attributes too.
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/audit.rb | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index c28a74cef..bc422ea7b 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -628,11 +628,20 @@ class FormulaAuditor return unless formula.tap.git? # git log is required fv = FormulaVersions.new(formula, :max_depth => 10) - revision_map = fv.version_attributes_map([:revision], "origin/master") - revisions = revision_map[formula.version] - if !revisions.empty? - problem "revision should not decrease" if formula.revision < revisions.max - elsif formula.revision != 0 + attributes = [:revision] + attributes_map = fv.version_attributes_map(attributes, "origin/master") + + attributes.each do |attribute| + attributes_for_version = attributes_map[attribute][formula.version] + if !attributes_for_version.empty? + if formula.send(attribute) < attributes_for_version.max + problem "#{attribute} should not decrease" + end + end + end + + revision_map = attributes_map[:revision] + if formula.revision != 0 if formula.stable if revision_map[formula.stable.version].empty? # check stable spec problem "revision should be removed" |
