Streamline Development and Enforce Rules Effortlessly with CQLinq

Code Rule & Code Query

CppDepend revolutionizes code analysis with its integration of CQLinq, a feature that allows querying the code base using LINQ queries. For instance, the following CQLinq query identifies all public methods exceeding 30 lines of code.

cqlinq query 1

When creating a new CppDepend project, you receive 120 default queries and rules, which are easily customizable to suit your requirements.

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

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


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

cqlinq query result

Powerful and elaborated queries and rules can be written with CQLinq, like the following one for example:

cqlinq query

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?

short cqlinq query

Which methods have been refactored since the last release?

browse source code with cqlinq

Which classes inherit from a particular class?

browse for classes with cqlinq

What are the 10 most complex methods?

browse for most complex methods with cqlinq

Which methods assign a particular field?

browse for methods with cqlinq

Which complex method is not enough commented?

browse for not commented methods with cqlinq

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:

be warned when a cqlinq query returns a result

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

methods should not have more than a specific lines of code warning

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

Custom naming conventions

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

Public methods should not be removed to avoid API breaking changes

Related Link:

CQLinq Performance.

CppDepend offers a wide range of features. It is often described as a Swiss Army Knife for C and C++ developers.

Start Free Trial