Permalink
Browse files

Merge pull request #3269 from DomT4/assert_predicate

audit: prefer assert/refute_predicate over File.exist?
  • Loading branch information...
MikeMcQuaid committed Oct 6, 2017
2 parents dd2083d + 4e95716 commit 3c0162a5ba387085c93b5172bdf6696e2045063e
Showing with 8 additions and 0 deletions.
  1. +8 −0 Library/Homebrew/dev-cmd/audit.rb
@@ -967,6 +967,14 @@ def line_problems(line, _lineno)
problem "Use `assert_match` instead of `assert ...include?`"
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
problem "`#{Regexp.last_match(1)}` in formulae is deprecated" if line =~ /(env :(std|userpaths))/

0 comments on commit 3c0162a

Please sign in to comment.