Code Query Language

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:

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:

SELECTMETHODSWHERENbILInstructions>200AND!NameLike “Generated"ORDERBYNbILInstructionsDESC

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.

If you liked this post, consider subscribing to email updates about my new posts, or sharing it on Hacker News.

Keyboard shortcuts

?
Show this help
Esc
Close this help or an open menu
n
Next (newer) post: Expression Web Designer Is Here
p
Previous (older) post: Practical.NET2 and C#2
Tab
Move between links and buttons (Shift+Tab to go back)