audit: prefer assert/refute_predicate over File.exist?

This commit is contained in:
Dominyk Tiller 2017-10-05 02:52:21 +01:00
parent 57035b3ba4
commit 4e957165d1
No known key found for this signature in database
GPG Key ID: FE19AEFCF658C6F6

View File

@ -967,6 +967,14 @@ class FormulaAuditor
problem "Use `assert_match` instead of `assert ...include?`" problem "Use `assert_match` instead of `assert ...include?`"
end end
if line =~ /(assert File\.exist\?|File\.exist\?)/
problem "Use `assert_predicate <path_to_file>, :exist?` instead of `#{Regexp.last_match(1)}`"
end
if line =~ /(assert !File\.exist\?|!File\.exist\?)/
problem "Use `refute_predicate <path_to_file>, :exist?` instead of `#{Regexp.last_match(1)}`"
end
return unless @strict return unless @strict
problem "`#{Regexp.last_match(1)}` in formulae is deprecated" if line =~ /(env :(std|userpaths))/ problem "`#{Regexp.last_match(1)}` in formulae is deprecated" if line =~ /(env :(std|userpaths))/