Code Query Language


Patrick Smacchia just released an alpha of an interesting application (NDepend) that can be used to analyze manage code binaries. It’s similar to FxCop. One really nice difference is that you can extend the tool using scripts written in CQL (code query language).


 


It would be even better if the query language could be any CLI language (for example IronPython) and the query language LINQ based. Patrick, what do you think? 🙂

Comments (6)

  1. Keith Farmer says:

    LINQ-based, you say? 😉

    — kfarmer [MSFT:DLinq]

  2. The LINQ/CLI language integration idea is appealing. After all, there is QL in CQL.

    However, I’m close to releasing a usable tool and I can’t wait for LINQ.  It will be time to integrate CQL and LINK on an Orcas schedule. CQL respect the pattern SELECT TOP xxx FROM xxx WHERE xxx ORDER BY xxx and thus, it should integrate seamlessly.

    Let me precise that FxCop rules and CQL queries/constraints are good complements to each other. Very few needs are covered by both tools.

    FxCop rules are an extensible set of rigid good practices which should be abided by every professional .NET dev.

    CQL constraints are customizable and typically tied with a particular application.

    For example, they can allow to specify customized encapsulation constraints such as, I want to ensure that this layer will never use this other layer or I want to ensure that this class will never be instantiated outside this particular namespace.

    CQL also address code metrics. For example you can ensure that most of your methods will never have more than 200 IL instructions or 4 parameters. More than 30 metrics are available. Moreover the metric based interactive treemap view provided by VisualNDepend helps developers to have a deeper understanding of the structure of their code.

  3. werner mairl says:

    @Patrick S.

    I think, Visual NDepend uses the FXCop core dll (Microsoft.cci.dll) to parse the MSIL Code

    With this library, it is very simple to implement a tool like CQL

    Unfortunately, you use a dotfuscator to hide the implementation details….

    werner (wm@schindler-IT.com)

  4. Patrick Smacchia says:

    No I’m not using  FXCop core dll to parse the MSIL code but the Cecil library which is free :

    http://www.mono-project.com/Cecil

    Indeed, VisualNDepend.exe is obfuscated since it will be a commercial tool.

    However NDepend and its libraries will remain free and open source.

    Soon, a free beta full featured will be available.

  5. Saurabh mehta says:

    Does NDepend able to restrict or measure the Loc…?

    as it is possible in FxCOP..i dont think so..!

  6. RG says:

    I like FxCop better

Skip to main content