Smart Code Review
- Source diff since Baseline
- Smart code review, not just source diff
- Review every facets of the delta since the baseline
- Improve Your Code Review Game with NDepend
The use case Write Clean Code From Now On explains that NDepend compares the actual code against a baseline snapshot. This way the issues-set is computed on both the actual code snapshot and the baseline snapshot. Then both issues-set are compared and NDepend tells you which issues have been introduced since the baseline. This lets the user focuses on fixing new issues first. This is the best way to stop increasing the technical debt.
Source diff since Baseline
But having a baseline in Visual Studio is also useful to quickly diff source files. At analysis time NDepend zips all source files. The menu Diff since Baseline is shown when right clicking any Visual Studio Solution Explorer item, or when right clicking anywhere in the source file code editor. This menu is enabled only if NDepend detects a change with the baseline version.
Per default the Visual Studio file diff feature is used to diff sources, but you can plug your preferred diff tool through Options > Source File Compare Tool.
Smart code review, not just source diff
Unlike other tools NDepend makes the difference between a change in the code logic and a minor source format change or a comment change. As a consequence the panel Search > Search by Changes proposes various options:
- Code was changed: Match code elements whose logic has been changed. Somehow the code behaves differently at runtime compared to the baseline version. The menu Diff since Baseline is available on any element right click to immediately diff the source.
- Visibility was Changed: As explained in the use case Detect API Breaking Changes being able to track types methods or fields whose visibility changed since baseline is useful to make sure that changes on your public API won't break your clients.
- Comments were Changed: Review only comment changes, no matter if the code logic has been changed or not.
- Track third-party code changes When reviewing some code changes it is worth inspecting changes in third-party code referenced. For example which method or which class is now used but wasn't used before (or vice-versa). Doing so can often leads to interesting discussions like: why do we now use DOM instead of SAX to parse some JSON (or XML) content?
These conventions are used in the search changes result:
- Underlined font for elements changed since baseline.
- Bold font for elements added since the baseline
- Bold strike font for elements removed since the baseline
Review every facets of the delta since the baseline
The NDepend dashboard shows the delta for each value presented, and also a up/down better/worst indicator. As any value on the dashboard, any delta value can be clicked. A LINQ query is then generated to dig into the delta. For example such generated query lists new issues, new classes or methods newly covered by tests.
Improve Your Code Review Game with NDepend
You can now read our blog post Improve Your Code Review Game with NDepend. It is about:
- NDepend Can Automate the Easy Stuff out of Code Review
- Make Your Code Review Visual
- Command of CQLinq
- Trend Metrics in Code Review
- It’s About Perspective