diff --git a/developer/bin/irregular_cask_whitespace b/developer/bin/irregular_cask_whitespace index a892643ccef9..4e923335433f 100755 --- a/developer/bin/irregular_cask_whitespace +++ b/developer/bin/irregular_cask_whitespace @@ -51,13 +51,29 @@ _irregular_cask_whitespace () { cd "$directory" || die "Could not cd to '$directory'" printf "# No trailing newline at EOF\n" - perl -C32 -0777 -ne 'print " $ARGV\n" if m{[^\n]\z}s' -- ./*.rb + perl -C32 -0777 -ne 'print " $ARGV\n" if m{[^\n]\z}s' -- ./*.rb printf "\n# Extra trailing newline at EOF\n" - perl -C32 -0777 -ne 'print " $ARGV\n" if m{\n{2}\z}s' -- ./*.rb + perl -C32 -0777 -ne 'print " $ARGV\n" if m{\n{2}\z}s' -- ./*.rb printf "\n# Final 'end' indented\n" - perl -C32 -0777 -ne 'print " $ARGV\n" if m{ end\s+\z}s' -- ./*.rb + perl -C32 -0777 -ne 'print " $ARGV\n" if m{ end\s+\z}s' -- ./*.rb + + printf "\n# Extra newline before final end\n" + perl -C32 -0777 -ne 'print " $ARGV\n" if m{\n\nend\s+\z}s' -- ./*.rb + + printf "\n# Extra newline before header\n" + perl -C32 -0777 -ne 'print " $ARGV\n" if m{\n\ncask\s+:v\d\S*\s+=>}s' -- ./*.rb + + printf "\n# Extra newline after header\n" + perl -C32 -0777 -ne 'print " $ARGV\n" if m{(?:\A|\n)cask\s+:v\d\S*\s+=>[^\n]+\n\n\s*(\S+)}s and $1 ne "if"' -- ./*.rb + + printf "\n# No empty line before uninstall\n" + perl -C32 -0777 -ne 'print " $ARGV\n" if m{\n[^\n]+\n +uninstall }s' -- ./*.rb + + # todo? + # printf "\n# No empty line before caveats\n" + # perl -C32 -0777 -ne 'print " $ARGV\n" if m{\n[^\n]+\n +caveats }s' -- ./*.rb printf "\n# Extra interior newlines\n" perl -C32 -0777 -ne 'print " $ARGV\n" if m{\n{3,}}s' -- ./*.rb