brew-audit - catch more interpolation style issues
This commit is contained in:
parent
2bb9fa1b22
commit
e9043abc57
@ -19,7 +19,7 @@ def audit_formula_text text
|
|||||||
problems << " * Remove 'use_mirror' from url."
|
problems << " * Remove 'use_mirror' from url."
|
||||||
end
|
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/
|
if text =~ /^\ ?depends_on/
|
||||||
problems << " * Check indentation of 'depends_on'."
|
problems << " * Check indentation of 'depends_on'."
|
||||||
end
|
end
|
||||||
@ -29,6 +29,11 @@ def audit_formula_text text
|
|||||||
problems << " * Don't need 'FileUtils.' before #{$1}."
|
problems << " * Don't need 'FileUtils.' before #{$1}."
|
||||||
end
|
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
|
# Check for string concatenation; prefer interpolation
|
||||||
if text =~ /(#\{\w+\s*\+\s*['"][^}]+\})/
|
if text =~ /(#\{\w+\s*\+\s*['"][^}]+\})/
|
||||||
problems << " * Try not to concatenate paths in string interpolation:\n #{$1}"
|
problems << " * Try not to concatenate paths in string interpolation:\n #{$1}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user