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?`" problem "Use `assert_match` instead of `assert ...include?`"
end 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)}`" problem "Use `assert_predicate <path_to_file>, :exist?` instead of `#{Regexp.last_match(1)}`"
end end
if line =~ /(assert !File\.exist\?|!File\.exist\?)/ if line =~ /assert !File\.exist\?/
problem "Use `refute_predicate <path_to_file>, :exist?` instead of `#{Regexp.last_match(1)}`" problem "Use `refute_predicate <path_to_file>, :exist?` instead of `assert !File.exist?`"
end end
return unless @strict return unless @strict