diff options
| author | Mike McQuaid | 2017-10-06 04:34:56 +0100 |
|---|---|---|
| committer | GitHub | 2017-10-06 04:34:56 +0100 |
| commit | 3c0162a5ba387085c93b5172bdf6696e2045063e (patch) | |
| tree | 092447b3dd6b4949c99a59b93c4db58db55d42d7 /Library/Homebrew/dev-cmd | |
| parent | dd2083d03d1fe679e8d91b384ce1c8e6ef237ad8 (diff) | |
| parent | 4e957165d14f14d7dc5a306bf9233ae17b6ed772 (diff) | |
| download | brew-3c0162a5ba387085c93b5172bdf6696e2045063e.tar.bz2 | |
Merge pull request #3269 from DomT4/assert_predicate
audit: prefer assert/refute_predicate over File.exist?
Diffstat (limited to 'Library/Homebrew/dev-cmd')
| -rw-r--r-- | Library/Homebrew/dev-cmd/audit.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 49e7969af..ee5fb8df8 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -967,6 +967,14 @@ class FormulaAuditor 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))/ |
