audit: warn once about deprecated *Formula classes

GithubGistFormula inherits from ScriptFileFormula so a problem is added
for each one instead of the first only.
This commit is contained in:
Baptiste Fontaine 2016-01-21 00:12:16 +01:00
parent 3d9bc57fea
commit e0c7b38aa7

View File

@ -224,17 +224,12 @@ class FormulaAuditor
end end
end end
if Object.const_defined?("GithubGistFormula") && formula.class < GithubGistFormula classes = %w[GithubGistFormula ScriptFileFormula AmazonWebServicesFormula]
problem "GithubGistFormula is deprecated, use Formula instead" klass = classes.find do |c|
Object.const_defined?(c) && formula.class < Object.const_get(c)
end end
if Object.const_defined?("ScriptFileFormula") && formula.class < ScriptFileFormula problem "#{klass} is deprecated, use Formula instead" if klass
problem "ScriptFileFormula is deprecated, use Formula instead"
end
if Object.const_defined?("AmazonWebServicesFormula") && formula.class < AmazonWebServicesFormula
problem "AmazonWebServicesFormula is deprecated, use Formula instead"
end
end end
# core aliases + tap alias names + tap alias full name # core aliases + tap alias names + tap alias full name