9.2 Checking Your Source Code’s Complexity with SourceMonitor

Adding a cyclomatic complexity check to your development process can quickly point you to potentially troublesome areas of your code base. SourceMonitor, written by James Wanner of Campwood Software, is a simple tool that gathers cyclomatic complexity statistics and other metrics for many languages, including C#, C++, C, Java, Delphi, Visual Basic (classic only), and even HTML. SourceMonitor also reports on 11 other useful metrics, including total lines in code files, number of classes, average number of methods per class, and statements per method. (See SourceMonitor’s documentation for a full listing and explanation of the metrics covered by the tool.)

One of SourceMonitor’s greatest features is its tracking of code changes through successive passes. Create a project in SourceMonitor containing all your source code and run an analysis pass on that project to create statistics. This results in a baseline of metrics against which you can measure each subsequent analysis pass, to monitor the overall complexity of your project. This will help you better understand your complexity versus features curve as you add functionality to your software.

SourceMonitor at a Glance

Tool

SourceMonitor

Version covered

2.0.4.7

Home page

http://www.campwoodsw.com/sm20.html

Power Tools page

http://www.windevpowertools.com/tools/6

Summary

Lightweight, ...

Get Windows Developer Power Tools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.