Sunday, September 09, 2007

best one-liner ever

We recently added the following to our bash profile:

alias testsyntax = 'svn stat | grep "\.php\$" | awk "{print \"php -l \" \$2}' | sh'

In English, filter the changed files in SVN for a .php extension, construct a PHP lint command for each, then execute. It's marvelous.

And for the enterprising reader, of course, similar lines could be constructed with the perl -wc, Javascript lint, HTML tidy, or W3C CSS validator tools.

Taken from Objectively Oriented: How to quickly lint PHP files in an upcoming svn commit.

0 comments: