Welcome to AspAdvice Sign in | Join | Help

Code Query Language

http://www.practicaldot.net/en2/main.htmHave 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:

http://www.ndepend.com/CQL.htm

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:

SELECT METHODS WHERE  NbILInstructions > 200 AND !NameLike "Generated" ORDER BY NbILInstructions DESC

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.

Published Friday, May 12, 2006 11:09 AM by ssmith
Filed under: , , ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Code Query Language

If you like NDepend, you may also wish to check out SemmleCode: it features an object-oriented code query language named .QL, with special support for recursive queries (handy for inspecting call graphs and the inheritance hierarchy), and tight Eclipse integration.

Thursday, April 05, 2007 7:37 AM by Oege de Moor

Leave a Comment

(required) 
required 
(required) 
Enter the code you see below