Maggie Nelson

Archive for May, 2007

3. Find x.

by maggie on May.21, 2007, under entry

Somehow math and smartasses tend to gravitate toward each other.


More: haha.nu.

Leave a Comment more...

How to quickly lint PHP files in an upcoming svn commit

by maggie on May.15, 2007, under entry

Nothing more embarassing than committing awesome code with a parse error. Quick

php -l

will take care of that. But if your repository has files under many directories and you’ve made changes to many files, it can be a pain to php -l all of them as you can only pass one file to “php -l” at a time.
Here’s a quick shortcut:

svn stat | grep ‘php’ | awk ‘{print “php -l ” $2}’ | sh

“svn stat” will list all files that have been changed. The grep will filter the result and only show PHP files. The awk command takes the 2nd column of the output and does “php -l” on every file in that column.
Granted, this is convenient but painful to type and error prone. Solution: save it in a file svnlint.sh, then add an alias:

alias svnlint=’sh ~/svnlint.sh’

At this point, before every:

svn commit

do:

svnlint

Your PHP files will be free of syntax errors (so you can focus on those “real” bugs…)

5 Comments more...


Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Tags

RSS Planet PHP

  • Getting started with the Midgard content repository
    I'm doing a talk today in the Bossa Conference about using Midgard as a content repository for mobile applications. As part of my presentation I wrote some simple example code for using the Midgard APIs in Python, and thought they would be good to share to those not attending the event as well. The idea of a content repository is that instead of coming […]
    Henri Bergius
  • Neural Networks in PHP
    Neural Networks in PHP By Louis Stowasser Neural networks allow emulating the behavior of a brain in software applications. Neural Networks have always had a too steep learning curve to venture towards, especially in a Web environment. Neural Mesh is an open source, pure PHP code based Neural Network manager and framework that makes it easier to work with […]
    PHP Classes
  • CMS Watch on their Midgard usage
    Which CMS does The Real Story Group Use? (Tony Byrne / CMS Watch): The answer is, we use an open-source platform called "Midgard." We picked it nearly ten years ago, and it has held up fairly well.... One of the things we like about Midgard actually makes it rather unsuitable for many simpler publishing scenarios: it is highly object-oriented. This […]
    Henri Bergius
  • Upgrades In Open Source
    PHP 5.3 has been out now for eight months, and in that time lots of projects have made decisions to begin developing against this version of PHP. Juozas Kaziukenas makes the argument that you shouldn’t be afraid of PHP 5.3 and he provides a number of excellent points to support his argument. I don’t dispute [...] […]
    Brandon Savage
  • Seed doc updates, and Gio async directory listing
    The documentation for seed gobject introspection is improving continually, I now have a jhbuild virtual machine, which is picking up the latest versions from git.In addition many of the documentation details have been expanded, includingInterfaces, Enumscallback methods are now documentedMore libraries have been added.More doc comments can be picked upWith b […]
    Alan Knowles