Skip to Main Content
Visual Studio Hacks
book

Visual Studio Hacks

by James Avery
March 2005
Intermediate to advanced content levelIntermediate to advanced
304 pages
19h 23m
English
O'Reilly Media, Inc.
Content preview from Visual Studio Hacks
264
|
Chapter 7, Help and Research
#66 Generate Statistics on Your C# Code
HACK
Study the Report
After analyzing either a Visual Studio Project or Solution, devMetrics dis-
plays the resulting project report (see Figure 7-37). This report lists each C#
Project analyzed, along with the following metrics:
Files
The number of C# files in the project.
Types
The number of classes, interfaces, and structures in the project.
Members
The number of fields, properties, events, methods, and constructors.
Lines
The total number of lines of code in the project, including blank lines
and comments.
Statements
The total number of statements in the project.
Average and maximum code complexity
devMetrics uses the cyclomatic code complexity algorithm as defined
by the Software Engineering Institute (see http://www.sei.cmu.edu/str/
descriptions/cyclomatic_body.html). The complexity is a measure of
linearly independent paths through a program module and is calcu-
lated for each member that contains statements. The code complexity
measurement results in a numerical evaluation, with lower values
meaning less complex code. The maximum code complexity is the
highest complexity value for all members in the project; the average
code complexity is the average complexity of all members.
In addition to showing these metrics for each project, the project report also
displays a summary row.
As Figure 7-37 shows, the name of each project
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Microsoft Visual Studio 2015 Unleashed, Third Edition

Microsoft Visual Studio 2015 Unleashed, Third Edition

Mike Snell, Lars Powers
.Net Framework Essentials

.Net Framework Essentials

Thuan L. Thai, Hoang Lam
C# 5.0 Unleashed

C# 5.0 Unleashed

Bart De Smet
Programming .NET Security

Programming .NET Security

Adam Freeman, Allen Jones

Publisher Resources

ISBN: 0596008473Errata Page