Merge pull request #2399 from MikeMcQuaid/unversioned-formulae-check

audit: check for unversioned formulae.
This commit is contained in:
Mike McQuaid 2017-03-30 19:06:47 +01:00 committed by GitHub
commit 7d66e29927

View File

@ -331,6 +331,13 @@ class FormulaAuditor
problem "File should end with a newline" unless text.trailing_newline? problem "File should end with a newline" unless text.trailing_newline?
if formula.versioned_formula?
unversioned_formula = Pathname.new formula.path.to_s.gsub(/@.*\.rb$/, ".rb")
unless unversioned_formula.exist?
unversioned_name = unversioned_formula.basename(".rb")
problem "#{formula} is versioned but no #{unversioned_name} formula exists"
end
else
versioned_formulae = Dir[formula.path.to_s.gsub(/\.rb$/, "@*.rb")] versioned_formulae = Dir[formula.path.to_s.gsub(/\.rb$/, "@*.rb")]
needs_versioned_alias = !versioned_formulae.empty? && needs_versioned_alias = !versioned_formulae.empty? &&
formula.tap && formula.tap &&
@ -351,6 +358,7 @@ class FormulaAuditor
ln -s #{formula.path.to_s.gsub(formula.tap.path, "..")} #{alias_name} ln -s #{formula.path.to_s.gsub(formula.tap.path, "..")} #{alias_name}
EOS EOS
end end
end
return unless @strict return unless @strict