Skip to content

Commit

Permalink
Merge pull request #3293 from DomT4/predicate_audit
Browse files Browse the repository at this point in the history
audit: more *_predicate nudging/tweaks
  • Loading branch information
MikeMcQuaid authored Oct 17, 2017
2 parents 5f64d0f + 0865ab0 commit 77f3fcf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Library/Homebrew/dev-cmd/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -974,8 +974,12 @@ def line_problems(line, _lineno)
problem "Use `assert_predicate <path_to_file>, :exist?` instead of `#{Regexp.last_match(1)}`"
end

if line =~ /assert !File\.exist\?/
problem "Use `refute_predicate <path_to_file>, :exist?` instead of `assert !File.exist?`"
if line =~ /(assert !File\.exist\?|assert !\(.*\)\.exist\?)/
problem "Use `refute_predicate <path_to_file>, :exist?` instead of `#{Regexp.last_match(1)}`"
end

if line =~ /(assert File\.executable\?|assert \(.*\)\.executable\?)/
problem "Use `assert_predicate <path_to_file>, :executable?` instead of `#{Regexp.last_match(1)}`"
end

return unless @strict
Expand Down

0 comments on commit 77f3fcf

Please sign in to comment.