NDepend users asked
our support how to automate showing diff in report. The goal for example, is to list all
assemblies/namespaces/types/methods/fields that have been added/changed/removed
since the last release. Here are the 3 steps:
Step1: Define the base line
define the base line, meaning, the previous versions of the code base against which the comparison
will be done. This can be done in VisualNDepend > Project Properties > Analysis > Build Comparison.
Step2: Define the diff rules and activate them
define your own diff CQL
rules that match your particular needs. By default, an NDepend project comes with a set of default CQL diff
queries. They can be found into the Diff \ Changes \ Evolution > Change Summary CQL default group. Selecting a diff query makes appear the matched diff result in the CQL Query Result panel of VisualNDepend.
However the result of a CQL query cannot be shown in report. Only result of CQL rules can be shown in the
report, under the conditions:
- The CQL rule is violated.
- The CQL rule is
- The option Display list of items selected in report
must be selected.
Thus, a CQL query needs
to be transformed into a rule. This is as simple as adding the prefix WARN IF Count > 0 IN to the query. Notice
that we activated the rule + we selected the option Display list of items selected in report:
You need also to make
sure that all parent CQL group of your CQL diff rules are also activated.
Step3: Show diff rules in report
Et voila, the
list of methods added is listed in the report.
Actually, before being listed in the report, result of violated CQL rules
are stored into an XML file named CQLResult.xml.
This file is stored in the output folder of the NDepend project. If you wish
to do more customized report you can easily parse the XML results. It is part
of the future plans to propose more facilities to harness automatically results.
Finally, while reporting
is great, a report will never be as informative as the real-time browsing capabilities
offered by VisualNDepend. Since NDepend version 2.12 a Search Panel is proposed to readily explore the diff between 2
snapshots of your application.