aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2016-08-18 12:55:19 +0100
committerMike McQuaid2016-08-18 15:04:51 +0100
commit41f6334b5b11e8cd2cc67750aee47d4acdb4ee52 (patch)
treeb54cb4a97db1bc67f5704c726ebd4622dd8f4f23
parenteea0da362bd01abc74e66e64909b0be11c01322e (diff)
downloadbrew-41f6334b5b11e8cd2cc67750aee47d4acdb4ee52.tar.bz2
audit: make audit_revision more generic.
This will allow it to be used for checking other attributes too.
-rw-r--r--Library/Homebrew/cmd/audit.rb19
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"