devMetrics
generates two different HTML reports during analysis:
The project
report provides a high-level summary of the project metrics while the member
report provides a detailed set of metrics for each member (function, property,
method, event, etc.) found in the code analyzed.
Report
Location
The output
directory for the reports may be controlled through the following methods:
-
Registry configuration
[HKEY_LOCAL_MACHINE\Software\Anticipating
Minds\devMetrics\1.0\ReportPath]
By default the installation program will set this registry value to:
[drive:\Program Files]\Anticipating Minds\devMetrics\Reports
-
Command line arguments.
See the
command line section for more details. If
no default directory is specified through either configuration or the command
line, the reports will be placed in the computers temp directory.
The project
report provides a summary of metrics for the projects analyzed.
Definition of
Measures
- Project Elements
-
These are the major elements measured during analysis
-
- Project
-
This is the name of the project. If the project name is longer than 30
characters it will be truncated for display. Placing the mouse over the name
will provide the full name and path. Clicking on the project name will take you
to the detail report of members.
- Files
- This is the number of C#
files in the project (those files with the extension “.cs”)
-
- Classes
-
This is the number of classes, interfaces and structures in the project.
-
- Members
-
This is the number of members in the project and includes all fields and member
functions (events, properties, constructors, methods, etc.)
-
- Lines
-
This is the total number of lines counted in C# files and includes blank lines
and comments.
-
- Statements
-
This is the total number of C# statements in all C# files. Statements are not
the same as a line of code. A line may contain more than one statement and
there may be many lines in a file that are not statements. Statements typically
represent executable code and are a much better measure of code size than lines
of code. For a more detailed definition of C# statements, please see
ECMA’s C# Language Specification – ECMA-334
-
- Comments
-
This section summarizes the comment measures which are found in the C# files of
the project, and includes both regular comments (// and /* .. */) as well as
document comments (///). Measures of comments can be indicative of the
maintainability and understandability of your code. Low or zero values indicate
code that should be commented more.
-
Count – Total count of comments for all C# files in the
project.
-
Density – This is the percentage of comments relative to the
lines of code and is calculated by [Lines]/[Comment Count].
-
- Code Complexity
-
Code complexity is the cyclomatic code complexity introduced by Thomas McCabe
in 1976 and
defined by the SEI . Code complexity is a measure of the number of
linearly-independent paths through a program module and is calculated by
counting the number of decision points found in the code (if, else, do, while,
throw, catch, return, break, etc.). Code complexity is calculated for each
member that contains code statements. Members that have a high code complexity
should be reviewed for possible refactoring. The SEI provides a basic risk
assessment based on the values of code complexity:
-
-
|
Cyclomatic Complexity |
Risk Evaluation |
| 1 to 10 |
a simple program, without very much risk |
| 11 to 20 |
a more complex, moderate risk |
| 21 to 50 |
a complex, high risk program |
| > 50 |
an untestable program (very high risk) |
-
-
Avg - This is the average cyclomatic code complexity for all
members of the project that contain statements.
-
Max -This is the code complexity for the member found with the
highest cyclomatic code complexity measure in the project.
-
- Statements/Member
-
Statements per member is the number of statements found in each member having
at least one statement. The measure can be indicative of large modules of code.
Many believe that there is no need to have large modules and any large modules
found should be refactored to improve maintainability. Large members are
typically associated with a high value for cyclomatic code complexity (see
above).
-
-
-
Avg – This is the average number of statements per member for
all members that contain at least one statement.
-
Max – This is the number of statements found in the largest
member within the project.
-
- Members/Class
-
Members per class is the number of members each of the classes of the project
has and includes all fields and member functions (events, properties,
constructors, methods, etc.). A large numbers of member in a class
can indicate an overly complex class that is most likely a candidate for
refactoring.
-
-
-
Avg – This is the average number of members per class for the
entire project.
-
Max – This is the number of members for the class with
greatest number of members in the project.
-
The last row of the report table is an overall summary of metrics for all
projects analyzed. Addition information provided on the report consists
of the date and time the analysis was run, a link to this help file, a
link to the detail member report at the bottom as well as a link to the
Anticipating Minds web site. If any errors occur in the analysis of a specific
project, there will also be a link to an error report. If you experience any
problems, please contact Anticipating Minds support at
support@anticipatingminds.com
For information on customizing the report format, please see the configuration
section below
The member report provides a detailed list of metrics for each member in all the
projects analyzed.
Definition of Measures
- Member Locations
- Project
-
This is the name of the project the member is located in. If the project name
is longer than 30 characters it will be truncated for display. Placing the
mouse over the name will provide the full name and path.
-
- Class
-
This is the class, interface or structure that the member belongs to. If the
class name is longer than 30 characters it will be truncated for display.
Placing the mouse over the name will provide the full class name.
-
- Member
-
This is the name of the member for which the metrics are gathered. For
constructors, the name will be the name of the class, interface or structure it
is a member of. If there are overloads of the member they will not be
distinguished in the report (i.e. they will each have the same name). If the
member name is longer than 30 characters it will be truncated for display.
Placing the mouse over the name will provide the full member name.
-
- Member Measures
-
Member measures provide specific metrics for each member analyzed. Measures are
only provided for members that have at least one statement.
-
- Statements
-
This is the total number of C# statements in the member. Statements are not the
same as a line of code. A line may contain more than one statement and there
may be many lines in a member that are not statements. Statements typically
represent executable code and are a much better measure of code size than lines
of code. Many believe that there is no need to have large modules and any large
modules found should be refactored to improve maintainability. Large members
are typically associated with a high value for cyclomatic code complexity (see
below). For a more detailed definition of C# statements, please see
ECMA’s C# Language Specification – ECMA-334
-
- Comments
-
This is the total number of comments found in a member. Comments that are
considered in the member count include both regular comments (// and /* .. */)
as well as document comments (///). Document comments (///) just before the
member are also considered part of the member.
-
- Comment Ratio
-
This is the ratio member comments to the number of statements. This number is
provided as a factor to differentiate it from the common measure of Comment
Density shown in the project report. Low or zero values indicate code that
should be commented more.
-
- Complexity
-
Code complexity is the cyclomatic code complexity introduced by Thomas McCabe
in 1976 and
defined by the SEI . Code complexity is a measures the number of
linearly-independent paths through a program module and is calculated by
counting the number of decision points found in the code (if, else, do, while,
throw, catch, return, break, etc.). Code complexity is calculated for each
member that contains code statements. Members that have a high code complexity
should be reviewed for possible refactoring. The SEI provides a basic risk
assessment based on the values of code complexity:
-
-
-
|
Cyclomatic Complexity |
Risk Evaluation |
| 1 to 10 |
a simple program, without very much risk |
| 11 to 20 |
a more complex, moderate risk |
| 21 to 50 |
a complex, high risk program |
| > 50 |
an untestable program (very high risk) |
-
-
Report Configuration
The reports offer some basic configuration options to meet more specific needs
you may have. The types of configuration are:
- Report Path
-
The report path can be used to configure the default location where the reports
are placed. The value is set in the registry is:
-
-
-
[HKEY_LOCAL_MACHINE\Software\Anticipating
Minds\devMetrics\1.0\ReportPath]
-
-
-
This value can be modified to be any valid file location that the process has
permissions and visibility to write to. By default the value is:
-
-
[drive:\Program Files]\Anticipating Minds\devMetrics\Reports
-
-
- Style Sheet
-
The reports use a default style which is embedded within the HTML documents to
allow for maximum portability. The reports also reference an external cascading
style sheet that can be modified to provide a more customized look and feel. By
default, the reports reference the cascasding style sheet set in the registry
-
-
-
-
[HKEY_LOCAL_MACHINE\Software\Anticipating Minds\devMetrics\1.0\StyleSheet]
-
-
-
-
By default, this registry value is not set, and the report will reference a
style sheet located in the report directory called devMetrics.css
. By changing this registry value you can reference your own style sheet
locally or even accessible over the internet. A sample customized style sheet
is provided with the installation and is located at:
-
-
-
-
[drive:\Program Files]\Anticipating
Minds\devMetrics\SampleStyle.css
See Also
Visual Studio .NET Add-In | Command
Line