Code Query Language
Date Published: 12 May 2006
http://www.practicaldot.net/en2/main.htm Have you ever wanted to run some metrics on your code base, to try and gauge its quality or to try and find bad practices? There are some tools out there for such static analysis, such as FxCop and the built in tools in VSTS, as well as SSW’s regular expression based Code Auditor Tool. However, another approach, using a Code Query Language, seems to have a lot of potential. You can read the specification here:
For instance, one issue I have with some code analyzers is that they complain about generated code that was produced by third party tools that I have no control over. With CQL, excluding such things would be trivial, as this example query shows:
The language is still very young and I haven’t seen too many people talking about it yet (which to me means there aren’t many people using it yet), but I think it has great potential as a means of querying code as if it were any other data store. The reporting possibilities for this are endless (and, as such, will likely be abused to the point of reducing productivity in the name of quality, in some projects, but such is life). Anyway, it’s definitely worth checking out. Oh, and it’s written by Patrick Smacchia, whose book I just plugged in my last entry.
Steve is an experienced software architect and trainer, focusing on code quality and Domain-Driven Design with .NET.