diff options
| author | Mike McQuaid | 2016-11-02 12:00:05 -0400 |
|---|---|---|
| committer | GitHub | 2016-11-02 12:00:05 -0400 |
| commit | 134b650151dadf148decc37f9bb2048d7ca02df2 (patch) | |
| tree | 7681031c66190c0a5363b222e3c5215393738e08 /Library/Homebrew/dev-cmd | |
| parent | 2c43649ffc9eeea33b1f5533983c26a3bbb78f83 (diff) | |
| parent | 127461d8792ff9a638c86bfaaedbed3cda2d38db (diff) | |
| download | brew-134b650151dadf148decc37f9bb2048d7ca02df2.tar.bz2 | |
Merge pull request #1411 from MikeMcQuaid/audit-check-version-no-decrease
audit: check the stable version does not decrease.
Diffstat (limited to 'Library/Homebrew/dev-cmd')
| -rw-r--r-- | Library/Homebrew/dev-cmd/audit.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 1fa583705..e83cf1b8c 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -653,12 +653,14 @@ class FormulaAuditor def audit_revision_and_version_scheme return unless formula.tap # skip formula not from core or any taps return unless formula.tap.git? # git log is required + return if @new_formula 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 +668,14 @@ class FormulaAuditor end end - revision_map = attributes_map[:revision] + versions = attributes_map[:version].values.flatten + if !versions.empty? && 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 |
