aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2016-05-19 20:38:46 +0100
committerMike McQuaid2016-05-19 20:38:46 +0100
commite825f597544f4610995eaec50e10426d012e71bb (patch)
tree4c6e58f9c871d65ebd1d864360cf90910eb326b3 /Library
parentd2c9a923ea782047b2758f8701394287d11ecba4 (diff)
downloadbrew-e825f597544f4610995eaec50e10426d012e71bb.tar.bz2
audit: check for block inreplace with single sub. (#254)
There are unnecessarily verbose, have been documented to be avoided and it’s good to nudge people towards the other style.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/audit.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index d252909d0..4357cc098 100644
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -182,6 +182,10 @@ class FormulaAuditor
problem "'__END__' was found, but 'DATA' is not used"
end
+ if text =~ /inreplace [^\n]* do [^\n]*\n[^\n]*\.gsub![^\n]*\n\ *end/m
+ problem "'inreplace ... do' was used for a single substitution (use the non-block form instead)."
+ end
+
unless text.has_trailing_newline?
problem "File should end with a newline"
end