aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Contributions/examples/brew-audit.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/Library/Contributions/examples/brew-audit.rb b/Library/Contributions/examples/brew-audit.rb
index 666d52423..b9c36e00b 100755
--- a/Library/Contributions/examples/brew-audit.rb
+++ b/Library/Contributions/examples/brew-audit.rb
@@ -19,7 +19,7 @@ def audit_formula_text text
problems << " * Remove 'use_mirror' from url."
end
- # 2 (or more, if in an if block) spaces before depends_on, please
+ # 2 (or more in an if block) spaces before depends_on, please
if text =~ /^\ ?depends_on/
problems << " * Check indentation of 'depends_on'."
end
@@ -29,6 +29,11 @@ def audit_formula_text text
problems << " * Don't need 'FileUtils.' before #{$1}."
end
+ # Check for string interpolation of single values.
+ if text =~ /(system|inreplace|gsub!|change_make_var!) .* ['"]#\{(\w+)\}['"]/
+ problems << " * Don't need to interpolate \"#{$2}\" with #{$1}"
+ end
+
# Check for string concatenation; prefer interpolation
if text =~ /(#\{\w+\s*\+\s*['"][^}]+\})/
problems << " * Try not to concatenate paths in string interpolation:\n #{$1}"