Sorry for chipping into this thread so late, the forum stopped showing my new posts.
A couple of years ago I developed (for a client) a full JADE metadata analyser which includes a JADE source code parser. This can parse any Jade code it's given (from a single method to a whole schema) into an abstract syntax tree (AST) of objects. It uses a shift-reduce parser to parse expressions (which is the trickiest part of the whole thing) and is developed in JADE as a separate schema which exports interface and a package. Once you have the AST for a method you can easily walk the tree and do all sorts of checks on it. It has been used for many things, include automated peer review (to automate mundane tasks) - it checks development standards such as:
- transient leaks, including iterator leaks, even taking into account iterators created inside nested while loops.
- poorly named variables (e.g. Booleans must start with a verb, collections with "all").
- consistent variable definitions (we don't like one line per variable definition, rather they should have more than one on a line to make the lengh of a method less).
- access modes set correctly (believe it or not there are still developers who don't see the point of "protected"!!)
- no illegal commands (like beginTransaction, we have our own version of that).
- we can detect certain contention issues, such as a foreach on a large persistent collection.
- poor use of literals in code (to prevent "magic" numbers from creeping in).
- ensuring that methods are too deep or too long (we consider that to be poor programming style).
- etc.
It can also be used to do bulk automated modifications to the code (and structure) or a schema. We can modify the AST for a method then extract that as an scm file and reimport it into the database. This makes bulk changes (which would otherwise take months of effort) a lot easier to deploy. It can do the kinds of checks mentioned in this forum thread. I had considered using it to extend the JADE language by adding those things that we all want (operator overloading, ++ and -- operators etc). It could fairly easily take such "advanced" code and convert it back to normal JADE. The issue is developing another mini-IDE to support this.