Skip to content
Snippets Groups Projects
Unverified Commit 2a25825a authored by Dominyk Tiller's avatar Dominyk Tiller
Browse files

audit: tweak assert/refute_predicate audit

Addresses some of the issues I raised in https://github.com/Homebrew/homebrew-core/pull/19127#issue-263566817.
Would still like to work out a way to check `File.exist?`-style language
inside the `test do` block exclusively but for now it's better to be
too conservative on the audit than to be overly-zealous and flag too
much.
parent 30ac0408
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment