diff options
| author | Mike McQuaid | 2016-10-29 17:50:41 -0400 |
|---|---|---|
| committer | GitHub | 2016-10-29 17:50:41 -0400 |
| commit | 9ab38dd751b306ff23fc39f5dca12a24eb1206fc (patch) | |
| tree | b11fd13d54dee5400bc8f63ea6f901a613f3f166 | |
| parent | 8e874fa3335df8d55b37eed689a33e03d8695c63 (diff) | |
| parent | 762b76e43723f9c4b009c21217e4c3eea4b31adb (diff) | |
| download | brew-9ab38dd751b306ff23fc39f5dca12a24eb1206fc.tar.bz2 | |
Merge pull request #1366 from MikeMcQuaid/audit-check-version-decrease
audit: check the version does not decrease.
| -rw-r--r-- | Library/Homebrew/dev-cmd/audit.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 3095372a2..afa875bdb 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -655,10 +655,11 @@ class FormulaAuditor return unless formula.tap.git? # git log is required fv = FormulaVersions.new(formula, max_depth: 10) - attributes = [:revision, :version_scheme] + no_decrease_attributes = [:revision, :version_scheme] + attributes = no_decrease_attributes + [:version] attributes_map = fv.version_attributes_map(attributes, "origin/master") - attributes.each do |attribute| + no_decrease_attributes.each do |attribute| attributes_for_version = attributes_map[attribute][formula.version] next if attributes_for_version.empty? if formula.send(attribute) < attributes_for_version.max @@ -666,11 +667,14 @@ class FormulaAuditor end end - revision_map = attributes_map[:revision] + versions = attributes_map[:version].keys + if formula.version < versions.max + problem "version should not decrease" + end return if formula.revision.zero? - if formula.stable + revision_map = attributes_map[:revision] if revision_map[formula.stable.version].empty? # check stable spec problem "'revision #{formula.revision}' should be removed" end |
