CQLinq Feature

CQLinq: Code Query Linq


VBDepend lets query the code base over LINQ queries thanks to CQLinq. For example the following CQLinq query matches all methods that have more than 30 lines of code:


80 default queries and rules are provided when you create a new VBDepend project. They are easy to read and easy to adapt to your need.

Writing CQLinq queries and constraints is straightforward both because it is C# LINQ syntax and because VBDepend provides a CQLinq editor which supports:

  • Code completion / intellisense,
  • Live compile error description,
  • Integrated tooltip documentation.


Also, once the query is compiled, it gets executed immediately and its result is well displayed and browsable:



Short CQLinq queries can be written (or even generated) to get some immediate answers to questions about a code base.

Is the code layered correctly?



Which methods have been refactored since the last release?



Which classes inherit from a particular class?



What are the most complex methods?



What are the methods with too many parameters?



What are the types with too many fields?



Which complex method is not enough commented?



You can also be warned automatically when a CQLinq query returns a certain result. Such a CQLinq code query is actually a code rule such as:

I don't want that my User Interface layer to depend directly on the DataBase layer:



Methods out of MyProject1 and MyProject2 should not have more than 30 lines of code:



Static fields should not be named m_XXX (Custom naming conventions):



Public methods should not be removed to avoid API breaking changes:


Related Link:

CQLinq Performance.