Review: NDepend Focuses on Reporting and .NET 8 in Latest Release
With the latest release, NDepend continues to improve the product by adding a better reporting interface and the ability to analyze .NET 8.0 projects
As a web developer, the amount of tools to enhance a developer's productivity are long and vast. Everyone has their favorite tool they like to use when writing code.
But what about analyzing code? Some development tools on the market aren't as flexible for what developers need to truly determine if their code is good or not.
One such tool I've been using for a long time is NDepend for identifying bad practices, overall general architecture, or bad code in general.
What is NDepend?
NDepend is a static code analysis tool to determine the code quality of .NET projects. It has the ability to create a baseline report identifying the quality of code written within the project or solution. As the codebase grows, NDepend can run at any time to compare the current state of code with a previous code analysis.
In my opinion, what makes the tool extremely flexible is the CQLINQ (Code Query LINQ) feature which allows developers to query .NET code through LINQ queries. Such rules include "Identify methods or classes that are too large" or "Avoid interfaces too big." There are a total of over 300 rules on initial install. With the CQLINQ code language, NDepend gives you the ability to write and save your own queries.
The goal of NDepend's latest release was to provide an in-depth code analysis experience through interactive web reports, provide full support of .NET 8.0 and C# 12, and performance improvements in the UI.
One of the projects I'm focusing on for this review is my open source dashboard project called Tuxboard.
What new in Reports?
One other great feature I've been noticing is the ability to generate a report within 5 seconds. The amount of detail involved in each of these reports is amazing as well as generating a tabular format of the familiar NDepend dashboard. After running code analysis on various project sizes from a single project to 30 in a solution, the reports were immediately sent to a browser for viewing.
As mentioned above, the aim of this release was to create interactive reports similar to the dashboard. The included reports are:
- Overview - provides an HTML view of the dashboard
- Issues - a list of C# code files sorted by the total number of issues. Clicking on a file drills-down into the source code identifying the issues by line number.
- Rules - all rules violated throughout the code base complete with debt estimations and visual cues
- Quality Gates - a summarized list of checks as to whether the code passes all gate checks; Color coding/visual cues were added;
- Trend - Centralized collection of line charts based on code analysis reports
- Logs - Logs captured from the output when running a code analysis
The reports are now consolidated into an interactive tabbed interface making everything easier to access.
Using the tabbed interface, we can see the Overview matching the extension's main dashboard, only in HTML form. Analyzing Tuxboard reveals the amount of tech debt in a percentage (3.41%) and dedicated time (4d) to complete the changes.
It also shows some of my code has violated some rules and has some issues.
The biggest difference with the release is the interactive Issues report. The Issues report breaks down by file as to where the major problems are found.
Clicking on the Issues tab displays the filename causing the issue.
Clicking on the filename drills-down further into the file showing the line causing the problem.
This provides a granular approach dissection of the problematic file by LINE NUMBER. Consider this approach if a Github merging screen was combined with a debugger.
Now I know what I have to fix to create cleaner code.
The Rules report is the flip-side of the Issues page. The Issues page shows the source code containing the errors where the Rules report shows all of the violations of a specific rule throughout the application.
Looking at the report, we can see there are 42 issues around non-static classes. When clicking on the link, we can see all of the rules violated and the name of the classes involved.
The Quality Gates report gives CI/CD pipelines a way to identify which parts of your code requires fixed before it can pass and be considered releasable software. As you can see, I need to make some modifications to Tuxboard.
The Trends report provides a visual representation of Size (Lines Of Code), % Coverage and % Debt, Issues, Rules, Quality Gates, and Debt. Again, these are the familiar charts shown in the NDepend dashboard extension.
Finally, the Logs tab gives a look at what assemblies NDepend analyzed and produces a log file for those interested in the details.
If you feel these tabbed reports weren't enough, the menu on the left side provides additional reporting metrics.
The new reporting interface definitely qualifies as an overall win.
Full Support of .NET 8.0 and C# 12
As expected with the release of .NET 8.0, NDepend now supports static code analysis of ASP.NET Core, Windows Desktop, Blazor, and console .NET 8.0 projects written in C# 12.
Performance Improvements in UI
The UI performance improvements are minor in this release, but shouldn't be shunned. When dealing with the loading of actual code base snapshots and base snapshots is now parralellized making it 40% faster, panels are now considered "lazy loaded" making the UI more responsive when snapshots are loaded, and the "Code to analyze" is 41% faster when loading assemblies.
NDepend has not disappointed over the years mainly because of the product's reputation to build on top of the existing features and making them better without affecting the core functionality of the product. Of course, this goes without saying with most software products.
Overall, the tabbed reporting is a welcome addition and was extremely helpful while moving around the report. However, there was one minor annoyance. For some reports, the data was displayed in a tabular form (naturally) but when I wanted to view more data, the horizontal scroll bar always appeared. I have two large monitors and the HTML report only took up a 1/4 of the space in the browser. Again, a minor annoyance, but nothing major.
Along with some rule updates and bug fixes (22x), I feel this was a solid release.
For more information, check out the release notes on NDepend's website.
For purchase details, refer to the purchase details.
Do you use NDepend? What is the one feature in NDepend you can't live without? What is missing from the product? Post your comments below and let's discuss.