The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Code Formatting Tool (PHP)

Though this is probably applicable to any language, can anybody recommend a specific program or script (Perl, Python?) that will format PHP source code to a given set of rules. I'm on Mac OS X, so something that will run there (even in Terminal.app) would be most appropriate.
Gavin Laking Send private email
Monday, November 20, 2006
 
 
I don't know of anything that does it in realtime, but you can definitely do it at check-in time.  Here is what some acquantences did recently:

http://blogs.lib.ncsu.edu/page/web?entry=codesniffer_pear_package

In phpClipse (Eclipse plugin for php), I've been able to tweak the defaults to conform with the PEAR Standards pretty easily.  Now I have to manually de-standardize something.  I'm going to start using the Zend IDE soon, so I might have more info there... not sure if it'd work for you though.
KC Send private email
Monday, November 20, 2006
 
 
Hey, there's a smart idea that hadn't really crossed my mind before now- coding to a standard!

My own convention is for maximum readability, so whilst most of my functions are *ahem* 'convoluted', at least they read well; meaning a normal, competent programmer could read my code and determine I was trying to achieve.

They can then laugh heartily and submit random snippets to The Daily WTF for global merriment!

I'll have a look at CodeSniffer, thanks!
Gavin Laking Send private email
Monday, November 20, 2006
 
 
Berislav Lopac Send private email
Monday, November 20, 2006
 
 
For when you finally have it formatted how you like:
http://pear.php.net/package/PHP_CodeSniffer/
Jeff Send private email
Monday, November 20, 2006
 
 
Sorry duplicated what KC said.
Jeff Send private email
Monday, November 20, 2006
 
 
"My own convention is for maximum readability, so whilst most of my functions are *ahem* 'convoluted', at least they read well; meaning a normal, competent programmer could read my code and determine I was trying to achieve."

Ugh.  Never create your own "coding standard" because *by definition* it's not standard beyond you.

Take PEAR or one of the other common standards and figure out where/why it doesn't work for you.  Then stop and think about it and figure out if your reasoning is solid/legitimate and look at it again.

At the very least, use PEAR plus a few of your local (team-wide) tweaks.
KC Send private email
Tuesday, November 21, 2006
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz