Merge pull request #3287 from DomT4/assert_predicate_audit

audit: tweak assert/refute_predicate audit
This commit is contained in:
ilovezfs 2017-10-08 00:05:24 -07:00 committed by GitHub
commit b568179222

View File

@ -967,12 +967,12 @@ class FormulaAuditor
problem "Use `assert_match` instead of `assert ...include?`"
end
if line =~ /(assert File\.exist\?|File\.exist\?)/
if line =~ /(assert File\.exist\?|assert \(.*\)\.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)}`"
if line =~ /assert !File\.exist\?/
problem "Use `refute_predicate <path_to_file>, :exist?` instead of `assert !File.exist?`"
end
return unless @strict