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.
This commit is contained in:
Mike McQuaid 2016-05-19 20:38:46 +01:00
parent d2c9a923ea
commit e825f59754

View File

@ -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