On my recent project at work, I’ve instigated a number of features:
- An XSLT stylesheet that strips out all inline JavaScript and inline CSS before it ever hits the browser. Go-go Unobtrusive JavaScript!
- Lots of jUnit tests:
- Every piece of static HTML gets validated via RelaxNG (we had to use RelaxNG in order to allow mixed namespaces).
- Ditto for every piece of XSLT.
- A well-formedness test for every piece of XML.
- A jslint test to check every file of JavaScript isn’t doing anything silly.
- A “no tabs” test to ensure that there are no literal tabs in any piece of source code (in accordance with our local conventions).
I haven’t yet gotten around to integrating checkstyle. And I really need to write an XQuery parser that understands the ancient dialect we seem to be saddled with.
On the whole, these tests have proved to be a minor inconvenience up-front, often leading to groans around the office when the build breaks. But as a whole they’ve kept the code base clean and managed to detect problems early. So on the whole they’re a win. I’ll definitely be dragging them along to my next project.